Gestational diabetes mellitus (GDM) is a common pregnancy complication, particularly prevalent in obese women. Importantly, exercise has beneficial impacts on maternal glucose control and may prevent GDM in "at-risk" women. We aimed to determine whether a high-fat diet (HFD) exacerbates metabolic dysfunction and alters gut microbiome in GDM and whether endurance exercise prevents these changes. Uteroplacental insufficiency was induced by bilateral uterine vessel ligation (Restricted) or sham (Control) surgery on E18 in Wistar-Kyoto rats. Female offspring were fed a Chow or HFD (23% fat) from weaning (5 weeks) and at 16 weeks randomly allocated to remain Sedentary or to an exercise protocol of either Exercise prior to and during pregnancy (Exercise); or Exercise during pregnancy only (PregEx). Females were mated (20 weeks) and underwent indirect calorimetry (embryonic day 16; E16), glucose tolerance testing (E18), followed by 24-hr feces collection at E19 (n = 8-10/group). HFD consumption in female rats with GDM exacerbated the adverse metabolic adaptations to pregnancy and altered gut microbial populations. Specifically, the Firmicutes-to-Bacteroidetes ratio was increased, due to an underlying change in abundance of the orders Clostridiales and Bacteroidales. Maternal Exercise, but not PregEx, prevented the development of metabolic dysfunction, increased pancreatic β-cell mass, and prevented the alteration of the gut microbiome in GDM females. Our findings suggest that maternal exercise and diet influence metabolic and microbiome dysfunction in females with GDM, which may impact long-term maternal and offspring health.