Although maternal antibodies protect newborn babies from infection1,2, little is known about how protective antibodies are induced without prior pathogen exposure. Here we show that neonatal mice that lack the capacity to produce IgG are protected from infection with the enteric pathogen enterotoxigenic Escherichia coli by maternal natural IgG antibodies against the maternal microbiota when antibodies are delivered either across the placenta or through breast milk. By challenging pups that were fostered by either maternal antibody-sufficient or antibody-deficient dams, we found that IgG derived from breast milk was crucial for protection against mucosal disease induced by enterotoxigenic E. coli. IgG also provides protection against systemic infection by E. coli. Pups used the neonatal Fc receptor to transfer IgG from milk into serum. The maternal commensal microbiota can induce antibodies that recognize antigens expressed by enterotoxigenic E. coli and other Enterobacteriaceae species. Induction of maternal antibodies against a commensal Pantoea species confers protection against enterotoxigenic E. coli in pups. This role of the microbiota in eliciting protective antibodies to a specific neonatal pathogen represents an important host defence mechanism against infection in neonates.