Male genital morphology is remarkably diverse across internally fertilizing animals, a phenomenon largely attributed to sexual selection. Ecological differences across environments can alter the context of sexual selection, yet little research has addressed how this may influence the rapid, divergent evolution of male genitalia. Using the model system of Bahamas mosquitofish (Gambusia hubbsi) undergoing ecological speciation across blue holes, we used geometric morphometric methods to test (i) whether male genital shape (the small, approximately 1 mm long, distal tip of the sperm-transfer organ, the gonopodium) has diverged between populations with and without predatory fish and (ii) whether any observed divergence has a genetic basis. We additionally examined the effects of genetic relatedness and employed model selection to investigate other environmental factors (i.e. interspecific competition, adult sex ratio and resource availability) that could potentially influence genital shape via changes in sexual selection. Predation regime comprised the most important factor associated with male genital divergence in this system, although sex ratio and some aspects of resource availability had suggestive effects. We found consistent, heritable differences in male genital morphology between predation regimes: Bahamas mosquitofish coexisting with predatory fish possessed more elongate genital tips with reduced soft tissue compared with counterparts inhabiting blue holes without predatory fish. We suggest this may reflect selection for greater efficiency of sperm transfer and fertilization during rapid and often forced copulations in high-predation populations or differences in sexual conflict between predation regimes. Our study highlights the potential importance of ecological variation, particularly predation risk, in indirectly generating genital diversity.