Haem is an iron(II) complex with a quadridentate ligand. It has a square planar shape.
There is space for two extra co-ordinate bonds above and below the haem ring, one of which can be formed with H2O, which can be easily replaced by O2.
CO is toxic because it replaces oxygen co-ordinately bonded to Fe(II) in haemoglobin, but it forms a very stable complex.