Gut microbiota is one of the main components that influence human health status. The gut microflora begins to establish as early as the prenatal period, however, the most intensive colonization of the infant by maternal and environment microorganisms occurs during the intranatal and postnatal periods. The mother-placenta-fetus system lays the foundation for early formation of microbiota. The maternal microbiota starts changing during pregnancy in order to modify metabolism to make it more favourable to the fetus, and continues throughout pregnancy, influencing the incubation of the fetus's own microbiota. The development of the fetal microbiome is also affected by the microbiome of the uterus, amniotic fluid and umbilical cord, although these organs were previously thought to be sterile, like the fetal gut. Multi-year research findings refuted these assertions and proved the existence of a separate meconium microbiome, which does not coincide with the maternal microbiota. The postnatal factors, such as mode of delivery and type of infant feeding, also influence the development of the gut microbiota. Vaginal birth exposes infants to maternal vaginal microbiota. During cesarean section, infants are exposed to environmental microbiota, which disrupts natural microbial colonization. Breast milk has its own microbiome, which can change and adapt to the infant needs. Exclusive breastfeeding affects Bifidobacterium and Bacteroides colonization rates, which metabolize breast milk oligosaccharides, producing short-chain fatty acids as a byproduct. Probiotic therapy can be used to maintain sufficient levels of Bifidobacterium to form a healthy microbiota. This review presents the stages and conditions for the formation of the infant’s gut microbiota, as well as the relationship between them in the course of ontogenesis.