IntroductionGut microbiota (GM) has been implicated in gestational diabetes mellitus (GDM), yet longitudinal changes across trimesters remain insufficiently explored.MethodsThis nested cohort study aimed to investigate GM alterations before 24 weeks of gestation and their association with GDM. Ninety-three Chinese participants provided fecal samples during the first and second trimesters. Based on oral glucose tolerance tests, 11 participants were classified as GDM, and 82 as non-diabetic (ND). Using 16S rRNA sequencing, we analyzed both cross-sectional and longitudinal differences in GM structure between those two groups.ResultsIn the first trimester, GDM group exhibited lower levels of Bacteroides_H and Acetatifactor compared to ND group (p < 0.05). In the second trimester, GDM individuals showed increased abundance of Fusobacteriota and Firmicutes_D, and genera including Fusobacterium_A and Fournierella, while Anaerotruncus and others decreased (P<0.05). Inflammation-associated genera like Gemmiger_A_73129 and Enterocloster increased, while Megamonas decreased in overweight or obese GDM women, which was not identified in normal-weight women. The ratios of relative abundance of genera Streptococcus, Enterocloster, and Collinsella exceeded 1.5 in the GDM group, particularly in overweight or obese individuals. Inflammatory pathways related to African trypanosomiasis and Staphylococcus aureus infection were predicted to be up-regulated in overweight or obese GDM individuals but not in normal-weight GDM women.DiscussionThis study suggests that GM of women with GDM undergoes significant alterations between the first and second trimesters, potentially linked to inflammation, with more pronounced changes observed in overweight or obese individuals.