IMPORTANCE Little is known about the associations between migraine and type 2 diabetes and the temporality of the association between these 2 diseases. OBJECTIVE To evaluate the association between migraine and type 2 diabetes incidence as well as the evolution of the prevalence of active migraine before and after type 2 diabetes diagnosis. DESIGN, SETTING, AND PARTICIPANTS We used data from the E3N cohort study, a French prospective population-based study initiated in 1990 on a cohort of women born between 1925 and 1950. The E3N study participants are insured by a health insurance plan that mostly covers teachers. From the eligible women in the E3N study, we included those who completed the 2002 follow-up questionnaire with information available on migraine. We then excluded prevalent cases of type 2 diabetes, leaving a final sample of women who were followed up between 2004 and 2014. All potential occurrences of type 2 diabetes were identified through a drug reimbursement database. Statistical analyses were performed in March 2018. EXPOSURES Self-reported migraine occurrence. MAIN OUTCOMES AND MEASURES Pharmacologically treated type 2 diabetes. RESULTS From the 98 995 women in the study, 76 403 women completed the 2002 follow-up survey. Of these, 2156 were excluded because they had type 2 diabetes, leaving 74 247 women. Participants had a mean (SD) age of 61 (6) years at baseline, and all were free of type 2 diabetes. During 10 years of follow-up, 2372 incident type 2 diabetes cases occurred. A lower risk of type 2 diabetes was observed for women with active migraine compared with women with no migraine history (univariate hazard ratio, 0.80 [95% CI, 0.67-0.96], multivariable-adjusted hazard ratio, 0.70 [95% CI, 0.58-0.85]). We also observed a linear decrease in active migraine prevalence from 22% (95% CI, 16%-27%) to 11% (95% CI, 10%-12%) during the 24 years prior to diabetes diagnosis, after adjustment for potential type 2 diabetes risk factors. A plateau of migraine prevalence around 11% was then observed for 22 years after diagnosis. CONCLUSIONS AND RELEVANCE We observed a lower risk of developing type 2 diabetes for women with active migraine and a decrease in active migraine prevalence prior to diabetes diagnosis. Further targeted research should focus on understanding the mechanisms involved in explaining these findings.