Introduction: Pregnancy is associated with changes in sexual function and perhaps many more sexual problems when accompanied by particular disorders such as gestational diabetes. Objective: The present study was conducted to investigate factors associated with sexual functions in women with gestational diabetes. Materials and Methods: The present analytical, cross-sectional study was conducted on 300 women with gestational diabetes (150) and low-risk pregnant women (150) attending clinics affiliated to Mazandaran University of Medical Sciences in the north of Iran in 2019. A multistage cluster random sampling method was used, and samples were selected by convenience sampling method. The study data were collected using a demographic and obstetrics questionnaire, female sexual distress scale-revised, prenatal distress questionnaire, world health organization quality of life questionnaire, depression, anxiety, stress questionnaire, and a female sexual function index. Data analysis was done by descriptive statistics indicators, the Chi-square test, t-test, and multivariate linear regression. Results: The frequency of sexual dysfunction was 87.3% in women with gestational diabetes and 34.67% in low-risk pregnant women. Compared to women with low-risk-pregnancy, women with gestational diabetes reported lower sexual function scores (P=0.001). Women with gestational diabetes experience lower quality of life (P<0.05) than low-risk pregnant women. Besides, women with gestational diabetes experience higher levels of stress (P=0.001), more prenatal concerns (P=0.014), and higher sexual distress (P<0.05). The linear regression test showed that gestational diabetes in pregnant women predicts a significant reduction in sexual desire (β=-0.599; P= 0.001). Conclusion: Gestational diabetes predicts a significant reduction in sexual function during pregnancy due to the physical and psychological effects of gestational diabetes. Thus, it is recommended that pregnant women with gestational diabetes should be trained and counseled about gestational diabetes control and sexual function.