Socioeconomic position (SEP) strongly predicts late-life cognitive health, yet the pathways between SEP and cognitive function remain unclear. This study assessed whether and to what extent the association between SEP and cognitive function in the adult population in rural South Africa is mediated by some health conditions, behavioral factors, and social capital factors. In this cross-sectional study, we used data from the 2014-15 "Health and Aging Africa: A Longitudinal Study of an INDEPTH Community in South Africa" (HAALSI) cohort, including 5,059 adults aged 40+ years from the Agincourt sub-district in Mpumalanga Province, South Africa. SEP, the independent variable, was measured based on ownership of household goods. Cognitive function, the dependent variable, was assessed using questions related to time orientation and immediate and delayed word recall. We used the multiple-mediation analysis on 4125 individuals with complete values on all variables to assess the mediating roles of health conditions (hypertension, diabetes, obesity, and disability), behavioral factors (leisure physical activity, alcohol consumption, and tobacco smoking), and social capital factors (community's willingness to help, trust, sense of safety, and social network contact) in the association between SEP and cognitive function. Compared to adults in the poorest wealth quintile, those in the richest wealth quintile had better cognition (β = 0.903, p < 0.001). The mediation analysis revealed that health conditions mediated 20.7% of the total effect of SEP on cognitive function. In comparison, 3.3% was mediated by behavioral factors and only 0.7% by social capital factors. In the multiple-mediator model, 17.9% of the effect of SEP on cognitive function was jointly mediated by health conditions, behavioral factors, and social capital factors. Low socioeconomic position is a significant factor associated with poor cognitive function among adults aged 40 years and above in South Africa. Health conditions mainly mediate the effects between SEP and cognitive function. Therefore, actions to prevent and control chronic health conditions can serve as the entry point for intervention to prevent poor cognitive function among people with low socioeconomic status.