ATP + H2O + Mg(2+) + protoporphyrin IX = ADP + 3 H(+) + Mg-protoporphyrin IX + phosphate Porphyrin-containing compound metabolism; bacteriochlorophyll biosynthesis (light-independent). Belongs to the lipase/esterase LIP3/BchO family.