Bile acids are cholesterol-derived signaling molecules that regulate mammalian metabolism through sterol-sensing nuclear receptor transcription factors. In C. elegans, bile acid-like steroids called dafachronic acids (DAs) control developmental timing and longevity by activating the nuclear receptor DAF-12. However, little is known about the biosynthesis of these molecules. Here, we show that the DAF-36/Rieske oxygenase works at the first committed step, converting cholesterol to 7-dehydrocholesterol. Its elucidation as a cholesterol 7-desaturase provides crucial biochemical evidence that such oxygenases are key steroidogenic enzymes. By controlling DA production, DAF-36 regulates DAF-12 activities for reproductive development and longevity and may illuminate related pathways in metazoans.