Internationally accepted diagnostic criteria recommendations for gestational diabetes (GDM) in 2010 resulted in a rise in global prevalence of GDM. Our aim was to describe the trends in GDM before and after Icelandic guideline changes in 2012 and the trends in pregestational diabetes (PGDM). The study included all singleton births (N = 101 093) in Iceland during 1997-2020. Modified Poisson regression models were used to estimate prevalence ratios (PRs) with 95% confidence intervals (CIs) for risk of GDM overall and by maternal age group, as well as overall risk of PGDM, according to time period of birth. The overall prevalence of GDM by time period of birth ranged from 0.6% (N = 101) in 1997-2000 to 16.2% (N = 2720) in 2017-2020, and the prevalence of PGDM ranged from 0.4% (N = 57) in 1997-2000 to 0.7% (N = 120) in 2017-2020. The overall relative GDM prevalence rate difference before and after 2012 was 380%, and the largest difference was found among women aged <25 years at 473%. Risk of GDM increased in 2017-2020 (PR 14.21, CI 11.45, 17.64) compared to 1997-2000 and was highest among women aged >34 years with PR 19.46 (CI 12.36, 30.63) in 2017-2020. Prevalence rates of GDM and PGDM increased during the study period. An accelerated rate of increase in GDM was found after 2012, overall, and among all maternal age groups. Women aged >34 years had the greatest risk of GDM throughout all time periods, while women aged <25 years appear to have a higher relative rate difference after 2012.