Heme is a heterocyclic structure that contains a pocket where Iron atoms can fit in.
When looking at the structure of Heme in general
You will see that the nitrogen groups in the middle form a polar pocket. That pocket is where the Iron cation fits in to form covalent bonds with the nitrogen groups as shown in the next picture.
I hope that answers your question.