We conducted a prospective study of bacterial transmission among humans, nonhuman primates (primates hereafter), and livestock in western Uganda. Humans living near forest fragments harbored Escherichia coli bacteria that were ≈75% more similar to bacteria from primates in those fragments than to bacteria from primates in nearby undisturbed forests. Genetic similarity between human/ livestock and primate bacteria increased ≈3-fold as anthropogenic disturbance within forest fragments increased from moderate to high. Bacteria harbored by humans and livestock were approximately twice as similar to those of redtailed guenons, which habitually enter human settlements to raid crops, than to bacteria of other primate species. Tending livestock, experiencing gastrointestinal symptoms, and residing near a disturbed forest fragment increased genetic similarity between a participant's bacteria and those of nearby primates. Forest fragmentation, anthropogenic disturbance within fragments, primate ecology, and human behavior all influence bidirectional, interspecific bacterial transmission. Targeted interventions on any of these levels should reduce disease transmission and emergence.