Mediates magnesium influx to the cytosol. ATP + H2O + Mg(2+)(out) = ADP + H(+) + Mg(2+)(in) + phosphate By low extracellular levels of Mg(2+), proline and by osmotic shock. The leader of mgtA mRNA functions as a riboswitch, favoring transcription under low Mg(2+). Under limiting proline levels the MgtL peptide encoded within the mgtA leader is unable to be translated, also favoring transcription of full mgtA mRNA. Osmotic shock induction also depends on MgtL translation (Probable). Belongs to the cation transport ATPase (P-type) (TC 3.A.3) family. Type IIIB subfamily.