Planets form and obtain their compositions in disks of gas and dust around young stars. The chemical compositions of these planet-forming disks regulate all aspects of planetary compositions from bulk elemental inventories to access to water and reactive organics, i.e. a planets hospitality to life and its chemical origins. Disk chemical structures are in their turn governed by a combination of {it in situ} chemical processes, and inheritance of molecules from the preceding evolutionary stages of the star formation process. In this review we present our current understanding of the chemical processes active in pre- and protostellar environments that set the initial conditions for disks, and the disk chemical processes that evolve the chemical conditions during the first million years of planet formation. We review recent observational, laboratory and theoretical discoveries that have led to the present view of the chemical environment within which planets form, and their effects on the compositions of nascent planetary systems. We also discuss the many unknowns that remain and outline some possible pathways to addressing them.