One of the key factors behind the rapid evolution of molecular spintronics is the efficient realization of spin manipulation of organic molecules with a magnetic center. The spin state of such molecules may depend crucially on the interaction with the substrate on which they are adsorbed. In this paper we demonstrate, using ab initio density functional calculations, that the stabilization of a high spin state of an iron porphyrin (FeP) molecule can be achieved via chemisorption on magnetic substrates of different species and orientations, viz., Co(001), Ni(001), Ni(110), and Ni(111). The signature of hemisorption of FeP on magnetic substrates is evident from broad features in N K x-ray absorption (XA) and Fe L2,3 x-ray magnetic circular dichroism (XMCD) measurements. Our theoretical calculations show that the strong covalent interaction with the substrate increases Fe-N bond lengths in FeP and hence a switching to a high spin state (S = 2) from an intermediate spin state (S = 1) is achieved. Due to chemisorption, ferromagnetic exchange interaction is established through a direct exchange between Fe and substrate magnetic atoms as well as through an indirect exchange via the N atoms in FeP. The mechanism of exchange interaction is further analyzed by considering structural models constructed from ab initio calculations. Also, it is found that the exchange interaction between Fe in FeP and a Ni substrate is almost 4 times smaller than with a Co substrate. Finally, we illustrate the possibility of detecting a change in the molecular spin state by XMCD, Raman spectroscopy, and spin- polarized scanning tunneling microscopy .