As frontline workers, pharmacists often face significant work stress, especially in psychiatric settings. A multicenter cross-sectional design was conducted in 41 psychiatric hospitals. The Depression, Anxiety and Stress Scale–21 (DASS-21) was used to measure the mental health of 636 pharmacists. We also collected demographic data and work-related variables. The prevalence of depression, anxiety and stress was 20.60%, 22.96% and 8.96%, respectively. Multivariate logistic regression showed that several common factors were associated with depression, anxiety and stress, including professional identity (odds ratio [OR] = 0.132, 0.381 and 0.352) and verbal violence (OR = 2.068, 2.615 and 2.490). Those who were satisfied with their job were less likely to develop depression (OR = 0.234) or anxiety (OR = 0.328). We found specific factors associated with mental health. Older age (OR = 1.038) and perceived negative impact (OR = 2.398) of COVID-19 on medical work were associated with anxiety, and those with frontline experience with COVID-19 patients (OR = 2.306) were more likely to experience stress. More than one-fifth of pharmacists in psychiatric hospitals experienced symptoms of depression or anxiety during the pandemic, highlighting the need for policy change to improve workplace conditions and psychological well-being for this professional group.