With the rapid advancement of the educational reform, the requirements for primary and secondary school teachers are increasing, which makes the work pressure of teachers become greater, which can lead to a variety of mental health problems. It is the primary task to promote the psychological health of primary and secondary school teachers by analyzing the stress of teachers and putting forward reasonable countermeasures. The study aimed to analyze the direct and indirect effects of occupational stress on the mental health level of primary and secondary school teachers. 317 teachers from 6 rural primary and secondary schools in Zhejiang province were selected as research subjects. A questionnaire was designed to collect information of occupational stress, mental health, and social support scores. The teachers were compared for differences in gender, marriage status, class teacher, occupational stress, and mental health. The correlation among occupational stress, mental health, and social support was analyzed by structural equation model. The occupational stress of male teachers was higher than that of female teachers in self-development, work load, and career expectation, and the mental health was lower than that of female teachers in work (P < 0.05). The occupational stress of married teachers was significantly higher than that of unmarried teachers, and their mental health was significantly higher than that of unmarried teachers (P < 0.05). The occupational stress of teachers with senior professional titles was lower than that of teachers with primary and intermediate titles in the dimensions of self-development, work load, and career expectation (P < 0.05). The occupational stress of class teachers was higher than that of non-class teachers in terms of student factors, work load, and career expectation (P < 0.05). The direct path coefficient between occupational stress and mental health was -0.421, and the indirect path coefficient between occupational stress and mental health was -0.172. The occupational stress of male, married, class teacher, and teacher with the primary and intermediate titles was significantly greater than that of female, unmarried, non-class teacher, and senior title teacher. In conclusion, the occupational stress of primary and secondary school teachers can not only directly predict the mental health level, but also indirectly affect the mental health level through social support.