Most children in South Africa attending public schools are predisposed to malnutrition due to poor infrastructure and social inequality. This is despite the implementation of the National School Nutrition Programme to address barriers to learning associated with hunger and malnutrition and the National Development Plan to reduce child malnutrition through provision of social grants. In view of this, we compared malnutrition indicators and associated socio-demographic factors among children in rural Mpumalanga and urban Gauteng in South African public primary schools selected using a multistage cluster random sampling. A validated researcher-administered questionnaire was used to collect socio-demographic data of caregivers, along with primary school children data collected on age, sex, learning grade, and anthropometric measures. Malnutrition indicators, which are stunting (low height-for-age z-scores), underweight (low weight-for-age z-scores), thinness (low body-mass-index-for-age z-scores), and overweight/obesity (high body mass index) were computed using WHO Anthro Plus 1.0.4 and data were analyzed using Stata 18. A total of 903 children (rural = 390 and urban = 513) with a mean age of 10 ± 2 years in the foundation phase (learning grades one to three) and the intermediate learning phase (learning grades four to seven) participated with their caregivers (mean age: 39 ± 8 years). Significant levels of poor socio-demographic status were observed among caregivers living in the rural setting compared to in the urban setting. Overall, thinness (18%), stunting (12%), underweight (10%), and overweight/obesity (24%) were observed among school children. Children in the rural schools had a significantly higher prevalence of stunting (20% vs. 3%; p < 0.0001), underweight (17% vs. 2%; p < 0.0001) and thinness (28% vs. 7%; p < 0.001) than their urban counterparts. In the urban, the odds of stunting, underweight and thinness were less among school children, while overweight/obesity was twice as likely in the urban setting. The multivariate final model showed lower odds of underweight [adjusted odds ratio (AOR) = 0.16; 95% confidence interval (CI): 0.06–0.42] and stunting [AOR = 0.33; 95% CI: 0.13–0.87] in the urban compared to the rural schools. The association of stunting with sex [AOR =0.53; 95% CI: 0.30–0.94] and the intermediate learning phase [AOR = 7.87; 95% CI: 4.48–13.82] was observed in the rural setting, while thinness was associated with living in households with an income of USD 52.51 to USD 262.60/month [AOR = 2.89; 95% CI: 1.01–8.24] and receiving the child social grant [AOR = 2.49; 0.90–6.86] in the urban setting. Overweight/obesity was associated with living in a household with an income of USD 52.51 to USD 262.60/month [AOR = 1.80; 95% CI: 1.02–3.10]. The findings suggest nutritional intervention approaches that are accustomed to the context of settings to effectively tackle malnutrition.