Infectious colitis is one of the most common health issues worldwide. Microfold (M) cells actively transport luminal antigens to gut-associated lymphoid tissue to induce IgA responses; however, it remains unknown whether M cells contribute to the induction of cellular immune responses. Here we report that M cell-dependent antigen transport plays a critical role in the induction of Th1, Th17, and Th22 responses against gut commensals in the steady state. The establishment of commensal-specific cellular immunity was a prerequisite for preventing bacterial dissemination during enteropathogenic Citrobacter rodentium infection. Therefore, M cell-null mice developed severe colitis with increased bacterial dissemination. This abnormality was associated with mucosal barrier dysfunction. These observations suggest that antigen transport by M cells may help maintain gut immune homeostasis by eliciting antigen-specific cellular immune responses.