Postnatal colonization of the body with microbes is assumed to be the main stimulus to postnatal immune development. By transiently colonizing pregnant female mice, we show that the maternal microbiota shapes the immune system of the offspring. Gestational colonization increases intestinal group 3 innate lymphoid cells and F4/80(+)CD11c(+) mononuclear cells in the pups. Maternal colonization reprograms intestinal transcriptional profiles of the offspring, including increased expression of genes encoding epithelial antibacterial peptides and metabolism of microbial molecules. Some of these effects are dependent on maternal antibodies that potentially retain microbial molecules and transmit them to the offspring during pregnancy and in milk. Pups born to mothers transiently colonized in pregnancy are better able to avoid inflammatory responses to microbial molecules and penetration of intestinal microbes.