Type 2 diabetes is killing more people than ever, and early-life predictors remain critical for the development of effective preventive strategies. Pregnancy loss is a common event associated with later atherosclerotic disease and ischaemic heart failure and might constitute a predictor for type 2 diabetes. The objective of this study was to investigate whether pregnancy loss is associated with later development of type 2 diabetes.Using a Danish nationwide cohort, we identified all women born from 1957 through to 1997 and who had a diagnosis of type 2 diabetes during the period 1977 to 2017. The women were matched 1:10 on year of birth and educational level to women without diabetes in the general Danish population. Conditional logistic regression models provided odds ratios for type 2 diabetes with different numbers of pregnancy losses.We identified 24,774 women with type 2 diabetes and selected 247,740 controls without diabetes. Women who had ever been pregnant (ever-pregnant women) with 1, 2 and ≥ 3 pregnancy losses had ORs of type 2 diabetes of 1.18 (95% CI 1.13, 1.23), 1.38 (95% CI 1.27, 1.49) and 1.71 (95% CI 1.53, 1.92) compared with ever-pregnant women with no pregnancy losses, respectively. Women who never achieved a pregnancy had an OR of type 2 diabetes of 1.56 (95% CI 1.51, 1.61) compared with ever-pregnant women with any number of losses. Similar results were found after adjustment for obesity and gestational diabetes.We found a significant and consistent association between pregnancy loss and later type 2 diabetes that increased with increasing number of losses. Thus, pregnancy loss and recurrent pregnancy loss are significant risk factors for later type 2 diabetes. Future studies should explore whether this association is due to common background factors or whether prediabetic metabolic conditions are responsible for this association. Graphical abstract.