Differentiation of the digestive tube and formation of the gut unit as a whole, are regulated by environmental factors through epigenetic modifications which enhance cellular plasticity. The critical period of DNA imprinting lasts from conception until approximately the 1,000th day of human life. During pregnancy, besides agents that may directly promote epigenetic programming (e.g., folate, zinc, and choline supplementation), some factors (e.g., antibiotic use, dietary components) can affect the composition of the mother's microbiota, in turn affecting the fetal microbiome which interacts with the offspring's intestinal epithelial cells. According to available literature that confirms intrauterine microbial colonization, the impact of the microbiome and its metabolites on the genome seems to be key in fetal development, including functional gut maturation and the general health status of the offspring, as well as later on in life. Although the origin of the fetal microbiome is still not well-understood, the bacteria may originate from both the vagina, as the baby is born, as well as from the maternal oral cavity/gut, through the bloodstream. Moreover, the composition of the fetal gut microbiota varies depending on gestational age, which in turn possibly affects the regulation of the immune system at the barrier between mother and fetus, leading to differences in the ability of microorganisms to access and survive in the fetal environment. One of the most important local functions of the gut microbiota during the prenatal period is their exposure to foreign antigens which in turn contributes to immune system and tissue development, including fetal intestinal Innate Lymphoid Cells (ILCs). Additional factors that determine further infant microbiome development include whether the infant is born premature or at term, the method of delivery, maternal antibiotic use, and the composition of the mother's milk, among others. However, the latest findings highlight the fact that a more diverse infant gut microbiome at birth facilitates the proliferation of stem cells by microbial metabolites and accelerates infant development. This phenomenon confirms the unique role of microbiome. This review emphasizes the crucial perinatal and postnatal factors that may influence fetal and neonatal microbiota, and in turn gut maturation.