Background:The prevalence of gestational diabetes mellitus (GDM) and pre-gestational diabetes mellitus (PDM) has increased dramatically in the past decade in all ethnic groups. The prevalence also varies markedly among different ethnic groups. Each ethnic group must have its own data about GDM/PDM for improvement in women’s health care. We conducted this study with the main objective of assessing recent trends in the prevalence of PDM/GDM among pregnant women in the northern part of Thailand during the past two decades. The secondary objective is to identify the risk factors influencing the prevalence of DM in pregnancies.Patients and Methods:The maternal–fetal medicine database was accessed to retrieve consecutive obstetric records of women who gave birth in Chiang Mai University Hospital, Thailand, from January 2003 to December 2022. This is a 20-year study period of the same protocol of GDM screening policy, using the 50 g glucose challenge test as a screening test for the average risk group and the 100 g OGTT as a diagnostic test. The women were categorized into GDM, PDM and non-DM groups. Trends or percentage changes in the prevalence of GDM/PDM during the study period were evaluated. Risk factors related to GDM/PDM were identified.Results:Among 37,027 women who gave birth during the study period, the prevalence of DM in pregnancy was 11.4% (4223 cases), including 214 cases of PDM (0.6%) and 4009 cases of GDM (10.8%). The prevalence of PDM significantly increased from 0.3% in 2003 to 1.5% in 2022; also, the prevalence of GDM significantly increased, dramatically, from 3.4% in 2003 to 22.0% in 2022. The prevalence of GDM increased in recent years in all age groups (adolescent, reproductive and elderly groups), while that of PDM did not significantly change in the adolescent group during the study period. Maternal age and pre-pregnancy BMI significantly increased in the more recent years. Independent factors significantly associated with the prevalence of PDM/GDM include maternal age, pre-pregnancy BMI, higher socio-economic status, and urban areas of residence. Recent time is still an independent risk factor after adjustment for other known factors.Conclusions:Relatively, GDM and PDM are highly prevalent in the northern part of Thailand, and their prevalence continuously increased during the past two decades. The trend of increased prevalence was evident in all age groups. Increasing maternal age and pre-pregnancy BMI mainly contributed to the increase in the prevalence of GDM and PDM in recent years. Recent time is still an independent risk factor after adjustment for other known factors, indicating that some other unexplained risk factors are associated with the increase in prevalence of DM in recent years, possibly the increase in sedentary lifestyle. Modification of lifestyle, especially reducing pre-pregnancy BMI among reproductive women, may reduce the prevalence of DM in pregnancy.