Innate lymphoid cells (ILC) expressing the transcription factor RORγt induce the postnatal formation of intestinal lymphoid follicles and regulate intestinal homeostasis. RORγt+ ILC express the aryl hydrocarbon receptor (AhR), a highly conserved, ligand-inducible transcription factor believed to control adaptation of multicellular organisms to environmental challenges. We show that AhR is required for the postnatal expansion of intestinal RORγt+ ILC and the formation of intestinal lymphoid follicles. AhR activity within RORγt+ ILC could be induced by dietary ligands such as those contained in vegetables of the family Brassicaceae. AhR-deficient mice were highly susceptible to infection with Citrobacter rodentium, a mouse model for attaching and effacing infections. Our results establish a molecular link between nutrients and the formation of immune system components required to maintain intestinal homeostasis and resistance to infections.