The progressive increase of insulin resistance observed in pregnancy contributes to the pathophysiology of gestational diabetes mellitus (GDM). There is controversy whether vitamin D deficiency contributes to abnormal glycemic regulation in pregnancy. We tested the associations between first trimester 25-hydroxyvitamin D (25OHD) levels and: 1) the risk of developing GDM; 2) insulin resistance/sensitivity, beta cell function and compensation indices in a large population-based prospective cohort of pregnant women. Participants (n = 655) were seen at first (6-13 weeks) and second (24-28 weeks) trimesters for blood samples. At first trimester, 25OHD levels were measured. At second trimester, glucose and insulin were measured 3 times during the oral glucose tolerance test to estimate insulin resistance (HOMA-IR), beta cell function (HOMA-B), insulin sensitivity (Matsuda index), insulin secretion (AUCins/gluc) and beta cell compensation (ISSI-2). Based on IADPSG criteria, 54 participants (8.2 %) developed GDM. Lower first trimester 25OHD levels were associated with higher risk of developing GDM even after adjustment for vitamin D confounding factors and GDM risk factors (OR = 1.48 per decrease of one SD in 25OHD levels; P = 0.04). Lower first trimester 25OHD levels were associated with higher HOMA-IR (r = - 0.08; P = 0.03), lower Matsuda index (r = 0.13; P = 0.001) and lower ISSI-2 (r = 0.08; P = 0.04). After adjustment for confounders, we found no significant association with HOMA-B and AUCins/gluc. Our results suggest that low levels of 25OHD at first trimester are (1) an independent risk factor for developing GDM and (2) associated with insulin resistance at second trimester.