To investigate the association between intrauterine antidepressant exposure and offspring affective disorders over an 18-year follow-up period using Danish national registers. We included 42,988 singletons born during 1998–2011 and followed-up until 2016, death, emigration, or date of first affective disorder diagnosis. Children were categorised into two groups according to maternal antidepressant use within 2 years before and during pregnancy: continuation (use before and during pregnancy) or discontinuation (use before but not during pregnancy). The outcome was an affective disorders diagnosis in the offspring based on secondary/tertiary care records and primary care prescription data. Hazard ratios (HR) of affective disorders were estimated using Cox regression models. To consider confounding by shared environmental or genetic factors, we investigated the effect of paternal antidepressant use on the risk for affective disorders. Affective disorders were diagnosed in 1538 children. Children whose mothers continued antidepressants during pregnancy had an increased risk of affective disorders (HR = 1.20, 95% CI = 1.08–1.34), compared with children whose mothers discontinued before pregnancy. Similarly, continued paternal antidepressant use during pregnancy was associated with higher risk for offspring affective disorders (HR = 1.29, 95% CI = 1.12–1.49), compared to discontinuation. Based on data from primary and secondary/tertiary care, maternal antidepressant use during pregnancy was associated with an increased risk of affective disorders in the offspring. As similar associations were observed in children whose fathers continued antidepressant use across the pregnancy period, the observed association may be attributable to the underlying parental psychopathology, rather than the direct intrauterine exposure to antidepressants.