Background: Gender, possibly due to the influence of gonadal hormones, is presumed to play a role in the pathogenesis of multiple sclerosis (MS), but no studies have evaluated whether male infertility is associated with MS. Objective: To study the association between male factor infertility and prevalent as well as incident MS. Method: Our cohort was established by linkage of the Danish National in vitro fertilization (IVF) registry to The Danish Multiple Sclerosis Registry and consisted of 51,063 men whose partners had undergone fertility treatment in all public and private fertility clinics in Denmark between 1994 and 2015. Results: With a median age of 34 years at baseline, 24,011 men were diagnosed with male factor infertility and 27,052 did not have male factor infertility and made up the reference group. Men diagnosed with male factor infertility had a higher risk of prevalent (odds ratio (OR) = 1.61, 95% confidence interval (95% CI) 1.04–2.51) and incident MS (hazard ratio (HR) = 1.28, 95% CI 0.76–2.17) when compared to the reference group. Conclusion: This nationwide cohort study has shown, for the first time, an association between male infertility and MS which may be due to underlying common etiologies such as hypogonadism, shared genetics, or a joint autoimmune component.