Background Undernutrition and stunting are significant public health concerns globally, particularly in low- and middle-income countries. Nutritional intervention is the cornerstone of the management and prevention of these conditions. However, the gut microbiome has recently emerged as an essential modulator of the effects of nutritional interventions in undernutrition and stunting. This scoping review aims to examine the impact of nutrition intake (including if there is any intervention) over time on gut microbiome changes in infants and children under the age of 2 who experience undernutrition and stunting. Methods A literature search was conducted in PubMed and Cochrane Library, including studies from 2013 to 2023, using terms related to malnutrition, stunting, failure to thrive, and gut microbiome. Inclusion criteria were applied to select eligible studies for review. Five studies were chosen to be included in this review. Results The findings indicate that nutrition intake over time, including dietary supplementation and prebiotics, can influence the gut microbiome composition, diversity, and functionality in undernutrition and stunting infants and children. These may promote the growth of beneficial bacteria while reducing the abundance of harmful pathogens. Moreover, improvements in nutritional status, growth parameters, and immune function were observed in association with positive changes in the gut microbiota. Conclusion Nutrition intake can positively modulate the gut microbiome in undernutrition and stunting infants by supporting the growth of beneficial gut bacteria such as Actinobacteria, Bacteroides, Streptococcus, Bifidobacterium, Prevotella sp, and other bacterial taxa that vary with age, ultimately contributing to enhanced growth and development outcomes. Further studies are needed to better understand the mechanisms underlying these effects and to develop targeted nutritional interventions that optimize the gut microbiome in undernutrition and stunting infants and children under 2 years.