Mg2+ regulates many physiological processes and signalling pathways. However, little is known about the mechanisms underlying the organismal balance of Mg2+. Capitalizing on a set of newly generated mouse models, we provide an integrated mechanistic model of the regulation of organismal Mg2+ balance during prenatal development and in adult mice by the ion channel TRPM6. We show that TRPM6 activity in the placenta and yolk sac is essential for embryonic development. In adult mice, TRPM6 is required in the intestine to maintain organismal Mg2+ balance, but is dispensable in the kidney. Trpm6 inactivation in adult mice leads to a shortened lifespan, growth deficit and metabolic alterations indicative of impaired energy balance. Dietary Mg2+ supplementation not only rescues all phenotypes displayed by Trpm6-deficient adult mice, but also may extend the lifespan of wildtype mice. Hence, maintenance of organismal Mg2+ balance by TRPM6 is crucial for prenatal development and survival to adulthood.