Many reproductive proteins from diverse taxa evolve rapidly and adaptively. These proteins are typically involved in late stages of reproduction such as sperm development and fertilization, and are more often functional in males than females. Surprisingly, many germline stem cell (GSC) regulatory genes, which are essential for the earliest stages of reproduction, also evolve adaptively in Drosophila. One example is the bag of marbles (bam) gene, which is required for GSC differentiation and germline cyst development in females and for regulating mitotic divisions and entry to spermatocyte differentiation in males. Here we show that the extensive divergence of bam between Drosophila melanogaster and D. simulans affects bam function in females but has no apparent effect in males. We further find that infection with Wolbachia pipientis, an endosymbiotic bacterium that can affect host reproduction through various mechanisms, partially suppresses female sterility caused by bam mutations in D. melanogaster and interacts differentially with bam orthologs from D. melanogaster and D. simulans. We propose that the adaptive evolution of bam has been driven at least in part by the long-term interactions between Drosophila species and Wolbachia. More generally, we suggest that microbial infections of the germline may explain the unexpected pattern of evolution of several GSC regulatory genes.