We present electronic structure calculations for the one-dimensional magnetic chain compounds Ca_3CoRhO_6 and Ca_3FeRhO_6. The calculations are based on density functional theory and the local density approximation. We use the augmented spherical wave (ASW) method. The observed alternation of low- and high-spin states along the Co-Rh and Fe-Rh chains is related to differences in the oxygen coordination of the transition metal sites. Due to strong hybridization the O 2p states are polarized, giving rise to extended localized magnetic moments centered at the high-spin sites. Strong metal-metal overlap along the chains leads to a substantial contribution of the low-spin Rh 4d_{3z^2-r^2} orbitals to the exchange coupling of the extended moments. Interestingly, this mechanism holds for both compounds, even though the coupling is ferromagnetic for the cobalt and antiferromagnetic for the iron compound. However, our results allow to understand the different types of coupling from the filling dependence of the electronic properties.