Volatile molecules are the main condensible carriers of the elements essential for life, carbon, hydrogen and nitrogen. Their chemical evolution during star and planet formation determines the compositions of planets, including those destined to orbit in a habitable zone. Yet, the path from the ISM to planets is one fraught with complexity and twists, making it difficult to derive precise theoretical predictions for planetary chemistry. Planet-forming disks are no longer considered uniform well-mixed structures; rather, they are complex worlds with many different heterogenous environments, most of which play some part in determining the composition of planetesimals and planets. Direct observations of atomic and molecular abundances on all size scales are therefore needed for understanding planet formation at a very fundamental level, and for answering the question of how chemically common the Earth is among exoplanets. In the past years, great progress has been made in observing protoplanetary chemistry, in particular in measuring the molecular composition in protoplanetary disks across the planet-forming regions from 1 to 10s of AU. I will present recent observational work that demonstrates strong chemical evolution between the interstellar medium and planet-forming material, and discuss the implications our understanding of exoplanet composition and habitability.