Natural products preserved in the geological record can function as ‘molecular fossils’, providing insight into organisms and physiologies that existed in the deep past. One important group of molecular fossils is the steroidal hydrocarbons (steranes), which are the diagenetic remains of sterol lipids. Complex sterols with modified side chains are unique to eukaryotes, although simpler sterols can also be synthesized by a few bacteria1. Sterol biosynthesis is an oxygen-intensive process; thus, the presence of complex steranes in ancient rocks not only signals the presence of eukaryotes, but also aerobic metabolic processes2. In 1999, steranes were reported in 2.7 billion year (Gyr)-old rocks from the Pilbara Craton in Australia3, suggesting a long delay between photosynthetic oxygen production and its accumulation in the atmosphere (also known as the Great Oxidation Event) 2.45–2.32 Gyr ago4. However, the recent reappraisal and rejection of these steranes as contaminants5pushes the oldest reported steranes forward to around 1.64 Gyr ago (ref.6). Here we use a molecular clock approach to improve constraints on the evolution of sterol biosynthesis. We infer that stem eukaryotes shared functionally modern sterol biosynthesis genes with bacteria via horizontal gene transfer. Comparing multiple molecular clock analyses, we find that the maximum marginal probability for the divergence time of bacterial and eukaryal sterol biosynthesis genes is around 2.31 Gyr ago, concurrent with the most recent geochemical evidence for the Great Oxidation Event7. Our results therefore indicate that simple sterol biosynthesis existed well before the diversification of living eukaryotes, substantially predating the oldest detected sterane biomarkers (approximately 1.64 Gyr ago6), and furthermore, that the evolutionary history of sterol biosynthesis is tied to the first widespread availability of molecular oxygen in the ocean-atmosphere system.