The human fetus lives in a germ-free intrauterine environment and enters the outside world containing microorganisms from several sources, resulting in gut colonization. Full-term, vaginally born infants are completely colonized with a diverse array of bacterial families in clusters (Phyla) and species (>1000) by the first year of life. Colonizing bacteria communicating with the gut epithelium and underlying lymphoid tissues (‘bacterial–epithelial crosstalk’) result in a functional immune phenotype and no expression of disease (immune homeostasis). Appropriate colonization is influenced by the prebiotic effect of breast milk oligosaccharides. Adequate colonization results in an innate and adaptive mucosal immune phenotype via communication between molecular patterns on colonizing bacteria and pattern-recognition receptors (e.g., toll-like receptors) on epithelial and lymphoid cells. This ontogeny affects the immune system's capacity to develop oral tolerance to innocuous bacteria and benign antigens. Inadequate intestinal colonization with premature delivery, delivery by Cesarean section and excessive use of perinatal antibiotics results in the absence of adequate bacterial–epithelial crosstalk and an increased incidence of immune-mediated diseases [e.g., asthma, allergy in general and necrotizing enterocolitis (NEC)]. Fortunately, infants with inadequate intestinal colonization can be restored to a bacterial balance with the intake of probiotics. This has been shown to prevent debilitating diseases such as NEC. Thus, understanding the role of gut microbiota in programming of the immune phenotype may be important in preventing disease expression in later childhood and adulthood.