The high susceptibility of neonates to infections has been assumed to be due to immaturity of the immune system, but the mechanism remains unclear. By colonizing adult germ-free mice with the cecal contents of neonatal and adult mice, we show that the neonatal microbiota is unable to prevent colonization by two bacterial pathogens that cause mortality in neonates. The lack of colonization resistance occurred when Clostridiales were absent in the neonatal microbiota. Administration of Clostridiales, but not Bacteroidales, protected neonatal mice from pathogen infection and abrogated intestinal pathology upon pathogen challenge. Depletion of Clostridiales also abolished colonization resistance in adult mice. The neonatal bacteria enhanced the ability of protective Clostridiales to colonize the gut.