Magnesium (Mg2+) plays an essential role in many biological processes. Mg2+ deficiency is therefore associated with a wide range of clinical effects including muscle cramps, fatigue, seizures and arrhythmias. To maintain sufficient Mg2+ levels, (re)absorption of Mg2+ in the intestine and kidney is tightly regulated. Genetic defects that disturb Mg2+ uptake pathways, as well as drugs interfering with Mg2+ (re)absorption cause hypomagnesemia. The aim of this review is to provide an overview of the molecular mechanisms underlying genetic and drug-induced Mg2+ deficiencies. This leads to the identification of four main mechanisms that are affected by hypomagnesemia-causing mutations or drugs: luminal transient receptor potential melastatin type 6/7-mediated Mg2+ uptake, paracellular Mg2+ reabsorption in the thick ascending limb of Henle's loop, structural integrity of the distal convoluted tubule and Na+-dependent Mg2+ extrusion driven by the Na+/K+-ATPase. Our analysis demonstrates that genetic and drug-induced causes of hypomagnesemia share common molecular mechanisms. Targeting these shared pathways can lead to novel treatment options for patients with hypomagnesemia.