The transition of the sexual mode occurs widely in animal evolution. In Caenorhabditis nematodes, androdioecy, a sexual polymorphism composed of males and hermaphrodites having the ability to self-fertilize, has evolved independently multiple times. While the modification of noncoding regulatory elements likely contributed to the evolution of hermaphroditism, little is known about these changes. Here, we conducted a genome-wide analysis of conserved noncoding elements (CNEs) focusing on the evolution of hermaphroditism in Caenorhabditis nematodes. We found that, in androdioecious nematodes, mutations rapidly accumulated in CNEs' neighboring genes associated with sexual traits. Expression analysis indicate that the identified CNEs are involved in spermatogenesis in hermaphrodites and associated with the transition of gene expression from dioecious to androdioecious nematodes. Last, genome editing of a CNE neighboring laf-1 resulted in a change in its expression in the gonadal region undergoing spermatogenesis. Our bioinformatic and experimental analyses highlight the importance of CNEs in gene regulation associated with the development of hermaphrodites.