Public health unit (PHU) engagement in schools is important for promoting wellness in students. We aimed to investigate if PHU engagement with schools may have provided protection against the risk of depression and anxiety in students during the COVID-19 pandemic. We used longitudinal data from the Cannabis, Obesity, Mental health, Physical activity, Alcohol use, Smoking and Sedentary behaviour survey between the 2018/19 and 2020/21 academic years. Multilevel models were used to assess the association between PHU engagement with school mental health programs prior to the COVID-19 pandemic and depressive (Center for Epidemiologic Studies Depression scale Revised) and anxiety symptoms (Generalized Anxiety Disorder scale) during the COVID-19 pandemic. The sample included 23894 students across 104 secondary schools in British Columbia, Alberta, Ontario and Quebec. In confounder-adjusted models, PHU engagement before the pandemic was not associated with student depressive symptoms (B=-0.01, 95% CI=-0.04, 0.02), but was protective against anxiety symptoms (B=-0.03, -0.06, 0.001) during the COVID-19 pandemic. The results highlight that PHU engagement with mental health programming in schools was protective against anxiety for students during the COVID-19 pandemic. The findings support the importance of PHU engagement for improving student mental health and pandemic recovery.