This pilot cross-sectional study, conducted in two public hospitals in Malawi, assessed gestational diabetes mellitus (GDM) in pregnant women attending antenatal clinics and compared their dietary quality and food group consumption before and during pregnancy. The study targeted women aged 18 to 49 years within 24 to 28 weeks of gestation. GDM was diagnosed according to the International Association of Diabetes and Pregnancy Study Group criteria and assessed dietary quality before and during pregnancy using a 30-day qualitative food frequency questionnaire. We compared changes in dietary quality and specific food group mean scores using paired t-tests at p < 0.05. Of the 508 women enrolled, 22.7% were diagnosed with GDM. The overall diet quality significantly decreased during pregnancy compared to before; a similar trend was observed in women diagnosed with GDM compared to those without GDM (p < 0.0001). Among women with GDM, the mean score of the following food groups significantly (p < 0.05) decreased during pregnancy: cruciferous vegetables, deep orange vegetables and tubers, citrus fruits, deep orange fruits, other fruits, nuts and seeds, poultry, fish, low fat dairy, whole grains, and liquid oils and significantly (p < 0.05) increased in the following food groups; red meat, processed meat, sugar-sweetened beverages, sweets, sugary snacks and ice cream. In conclusion, GDM is prevalent in Malawian women enrolled in this study and is coupled with inadequate dietary quality, especially during pregnancy. Since dietary quality is pivotal to GDM management, more in-depth longitudinal dietary studies are needed to inform nutritional interventions to prevent and better manage GDM.