Prenatal drug exposure (PDE) is a global public health problem that is strongly associated with the need for child protection services, including placement into out-of-home care (OOHC). We aimed to assess school outcomes for children with PDE (both with and without neonatal abstinence syndrome [NAS]) and the association of school performance with OOHC. Using linked population health, OOHC, and school test data, we compared results on the Australian standardised curriculum-based test, the National Assessment Program-Literacy and Numeracy (NAPLAN), for children with PDE who were born in New South Wales (NSW) between 2001 and 2020 and had completed at least one NAPLAN test between Jan 1, 2008, and June 30, 2021, administered in Year 3 (age 8-9 years), Year 5 (age 10-11 years), Year 7 (age 12-13 years), or Year 9 (age 14-15 years). Linked datasets included NSW Perinatal Data Collection (birth data), NSW Admitted Patient Data Collection (hospital diagnoses), NSW Education Standards Authority (NAPLAN scores), NSW Family and Community Services Dataset-KiDS Data Collection (OOHC information), NSW Mental Health Ambulatory Data Collection, and NSW Registry for Births, Deaths, and Marriages. The primary outcome was scoring above or below the National Minimum Standard (NMS) in any test domain (mathematics, language, writing, and spelling) at each year level, comparing the relative risk of scoring below NMS between children with and without PDE (and with or without NAS within the PDE group), and with and without OOHC contact. The association between OOHC on the likelihood of scoring above NMS was also investigated for PDE and non-PDE cohorts. The PDE cohort included 3836 children, and the non-PDE cohort included 897 487 children. Within the PDE cohort, 3192 children had a NAS diagnosis and 644 children had no NAS diagnosis. 1755 (45·8%) children with PDE required OOHC compared with 12 880 (1·4%) of 897 487 children without PDE. Children with PDE were more likely than children without PDE to score below NMS in any domain from Year 3 (risk ratio 2·72 [95% CI 2·58-2·76]) to Year 9 (2·36 [2·22-2·50]). Performance was similar regardless of a NAS diagnosis (Year 3: 0·96 [0·84-1·10]; Year 9: 0·98 [0·84-1·15]). The likelihood of scoring above NMS in Year 9 was reduced for children with PDE and without NAS (0·57 [0·45-0·73]) and NAS (0·58 [0·52-0·64]) compared with those without PDE, and also for children who received OOHC (0·60 [0·57-0·64]) compared with those without OOHC, when adjusted for confounders. Among children with PDE, those receiving OOHC had a similar likelihood of scoring above NMS compared with children who did not receive OOHC, from Year 3 (1·01 [0·92-1·11]) to Year 9 (0·90 [0·73-1·10]), when adjusted for confounding factors. By contrast, among children without PDE, those receiving OOHC were less likely to score above NMS than those who did not receive OOHC, from Year 3 (0·78 [0·76-0·80]) to Year 9 (0·58 [0·54-0·61]). Compared with children without PDE, school performance in children with PDE-regardless of whether they were diagnosed with NAS-is poor, and the gap widens with age. The risk of poor performance persists regardless of OOHC status. This finding underscores the need for all children with PDE to receive long-term, culturally sensitive, and proactive support to improve life success. SPHERE Mindgardens Neuroscience Network, Australian Red Cross, Alpha Maxx Healthcare, Centre for Research Excellence for Integrated Health and Social Care, National Health and Medical Research Council, and University of Sydney.