Necrotizing enterocolitis (NEC) is an intestinal inflammatory disease with high morbidity and mortality that affects almost exclusively premature infants. Breast milk feeding is known to substantially lower NEC incidence, and specific components of breast milk, such as immunoglobulin (Ig) A, have been identified as mediating this protective effect. On the other hand, accumulating evidence suggests dysbiosis of the neonatal intestinal microbiome contributes to NEC pathogenesis. In mice, neonates can inherit a dysbiotic microbiome from dams that experience stress during pregnancy. Here we show that while prenatal stress lowers fecal IgA levels in pregnant mice, it does not result in lower levels of IgA in the breast milk. Nevertheless, coating of female, but not male, offspring microbiota by IgA is increased by prenatal stress. Accordingly, prenatal stress was found to alter the bacterial community composition in female neonates but not male neonates. Furthermore, female, but not male, offspring of prenatally stressed mothers exhibited more severe colonic tissue damage in a NEC-like injury model compared to offspring with non-stressed mothers. Our results point to prenatal stress as a possible novel risk factor for NEC and potentially reveal new avenues in NEC prevention and therapy.