Involved in bacteriochlorophyll pigment biosynthesis; introduces a magnesium ion into protoporphyrin IX to yield Mg-protoroporphyrin IX. ATP + H2O + Mg(2+) + protoporphyrin IX = ADP + 3 H(+) + Mg-protoporphyrin IX + phosphate Porphyrin-containing compound metabolism; bacteriochlorophyll biosynthesis (light-independent). Belongs to the Mg-chelatase subunit H family. Extended N-terminus.