maternal health during pregnancy can affect the intestinal microbial community of offspring, but currently the impact of intrauterine environmental changes resulting from gestational diabetes mellitus (GDM) on the microbiota of offspring as well as its interaction with the immune system remains unclear. to explore the impact of intrauterine microbial exposure during pregnancy of gestational diabetes mellitus on the development of neonate's intestinal microbiota and activation of immune responses. Levels of lipopolysaccharides in cord blood from GDM and expression of microbial recognition-related proteins in the placenta were measured. To evaluate embryonic intestinal colonization, pregnant mice with GDM were administered with labeled Escherichia coli or Lactobacillus. The intestinal colonization of pups was analyzed through 16S rRNA gene sequencing and labeled microbial culture. Additionally, memory T lymphocyte and dendritic cell co-culture experiments were conducted to elucidate the immune memory of intestinal microbes during the embryonic stages. Gestational diabetes mellitus led to elevated umbilical cord blood LPS level and increased GFP labeled Escherichia coli in the offspring's intestine after gestational microbial exposure. The mouse model of GDM exhibited increased immune markers including TLR4, TLR5, IL-22 and IL-23 in the placenta and a recall response from memory T cells in offspring's intestines, with similar observations found in human experiments. Furthermore, reduced intestinal microbiome diversity and an increased ratio of Firmicutes/Bacteroidetes was found in GDM progeny, with the stability of bacterial colonization been interfered. Our investigation has revealed a noteworthy correlation between gestational diabetes and intrauterine microbial exposure, as well as alterations in the neonatal microbiota and activation of immune responses. These findings highlight the gestational diabetes's role on offspring's gut microbiota and immune system interactions with early-life pathogen exposure.