Early prenatal stress disrupts maternal-to-offspring microbiota transmission and has lasting effects on metabolism, physiology, cognition, and behavior in male mice. Here we show that transplantation of maternal vaginal microbiota from stressed dams into naive pups delivered by cesarean section had effects that partly resembled those seen in prenatally stressed males. However, transplantation of control maternal vaginal microbiota into prenatally stressed pups delivered by cesarean section did not rescue the prenatal-stress phenotype. Prenatal stress was associated with alterations in the fetal intestinal transcriptome and niche, as well as with changes in the adult gut that were altered by additional stress exposure in adulthood. Further, maternal vaginal transfer also partially mediated the effects of prenatal stress on hypothalamic gene expression, as observed after chronic stress in adulthood. These findings suggest that the maternal vaginal microbiota contribute to the lasting effects of prenatal stress on gut and hypothalamus in male mice.