ObjectiveThis study aimed to compare the retina and choroid thickness in age-matched pregnant individuals with gestational diabetes mellitus, nonpregnant diabetic females, and healthy nonpregnant females. MethodThis cross-sectional study included 2 study groups, 1 composed of pregnant women with gestational diabetes mellitus and 1 consisting of nonpregnant type 2 diabetic patients without diabetic retinopathy, and a control group of healthy nonpregnant subjects. Swept-source optical coherence tomography was used to measure the retinal and choroidal thickness. The measurements were compared between the study groups and between the study groups and the control group. ResultsAll groups had similar mean ages, best-corrected visual acuity, and intraocular pressure (p = 0.122, p = 0.158, and p = 0.186, respectively). The mean central macular thickness of the gestational diabetes, type 2 diabetes, and control groups was 215.3 ± 10.83, 220.58 ± 21.62, and 230.03 ± 21.24 μm, respectively (p = 0.002). The retinal nerve fibre layer was slightly thinner only in the inferior zone of the study groups (p = 0.058) compared with the control group. We observed statistically significant differences in the thickness of all sectors of the ganglion cell layer between all groups (all p < 0.05), with the nonpregnant type 2 diabetic group exhibiting the lowest values. A similar mean subfoveal choroidal thickness was observed in all 3 groups (p = 0.247). ConclusionSwept-source optical coherence tomography plays an important role in detecting retinal neurodegenerative changes and choroidal thickness induced by gestational and type 2 diabetes before the development of diabetic retinopathy.