Mediates magnesium influx to the cytosol. ATP + H2O + Mg(2+)(out) = ADP + H(+) + Mg(2+)(in) + phosphate By low extracellular levels of Mg(2+) and by low levels of proline; induction is higher in the absence of both. Also by osmotic shock (0.3 M NaCl). The leader of mgtA mRNA functions as a riboswitch; at low Mg(2+) stem loop 'C' forms which favors transcription of the full-length mgtA mRNA. Under limiting proline levels the 17 residue, proline-rich MgtL peptide encoded within the mgtA leader is unable to be fully translated, and the same stem loop 'C' is able to fold, again favoring transcription of the full mgtA mRNA. Osmotic shock induction also depends on MgtL translation. Belongs to the cation transport ATPase (P-type) (TC 3.A.3) family. Type IIIB subfamily.