Perinatal characteristics are associated with subsequent risk of several chronic diseases. Previous studies regarding endometriosis were based on small samples and retrospective data and were limited by unmeasured confounding bias, leading to conflicting and inconclusive findings. We investigated the associations of maternal and birth characteristics with risk of endometriosis among Swedish women of reproductive age. This total-population register-based cohort study consisted of 628 312 singleton women born in Sweden between 1973 and 1987, who were followed for diagnosed endometriosis from age 15 years until the end of 2012. Multivariable Cox regression was applied to examine associations with perinatal characteristics. Residual unmeasured confounding was assessed through within-family and E-value analyses. During follow-up, 8262 women received an endometriosis diagnosis. There were clear dose-response/linear associations of endometriosis with lower maternal education, endometriosis in the mother [adjusted hazard ratio (aHR): 2.24, 95% confidence interval (CI): 2.04-2.46], maternal smoking during pregnancy (aHR: 1.18, 95% CI: 1.04-1.33 for moderate smoker and aHR: 1.36, 95% CI: 1.18-1.57 for heavy smoker vs non-smoker), lower birthweight, and lower birthweight-for-gestational age (aHR: 0.93 per standard deviation increase, 95% CI: 0.91-0.95). Within-family and E-value analyses suggested that these perinatal characteristics are robust predictors of the incidence of endometriosis. We also found that an estimated 26% of the association between maternal smoking and early-onset endometriosis could be explained by birthweight-for-gestational age. This study finds support for fetal origins of endometriosis, in that exposure to adverse environment or restricted development during the perinatal period may increase the risk. Further research is needed to provide an understanding of the underlying mechanisms. © The Author(s) 2019. Published by Oxford University Press on behalf of the International Epidemiological Association.