This condition is believed to occur secondary to the decreased normal physiologic magnesium inhibition of the ROMK channels in the apical tubular membrane.In this light, hypomagnesemia is frequently the cause of hypokalaemic patients failing to respond to potassium supplementation. Thus, clinicians should ensure that both magnesium and potassium is replaced when deficient. Patients with diabetic ketoacidosis should have their magnesium levels monitored to ensure that the serum loss of potassium, which is driven intracellularly by insulin administration, is not exacerbated by additional urinary losses. Calcium
Release of calcium from the sarcoplasmic reticulum is inhibited by magnesium. Thus hypomagnesemia results in an increased intracellular calcium level. This inhibits the release of  parathyroid hormone, which can result in hypoparathyroidism and hypocalcemia. Furthermore, it makes skeletal and muscle receptors less sensitive to parathyroid hormone. Arrhythmia
Magnesium is needed for the adequate function of the Na+/K+-ATPase pumps in cardiac myocytes, the muscles cells of the heart. A lack of magnesium inhibits reuptake of potassium, causing a decrease in intracellular potassium. This decrease in intracellular potassium results in a tachycardia. Pre-eclampsia
Magnesium has an indirect antithrombotic effect upon platelets and endothelial function. Magnesium increases prostaglandins, decreases thromboxane, and decreases angiotensin II, microvascular leakage, and vasospasm through its function similar to calcium channel blockers. Convulsions are the result of cerebral vasospasm. The vasodilatatory effect of magnesium seems to be the major mechanism. Asthma
Magnesium exerts a bronchodilatatory effect, probably by antagonizing calcium-mediated bronchoconstriction.
Magnesium plays an important role in carbohydrate metabolism and its deficiency may worsen insulin resistance, a condition that often precedes diabetes, or may be a consequence of insulin resistance.People being treated on an intensive care unit (ICU) who have a low magnesium level may have a higher risk of requiring mechanical ventilation, and death. Causes
Magnesium deficiency may result from gastrointestinal or kidney causes. Gastrointestinal causes include low dietary intake of magnesium, reduced gastrointestinal absorption or increased gastrointestinal loss due to rapid gastrointestinal transits. Kidney causes involve increased excretion of magnesium. Poor dietary intake of magnesium has become an increasingly important factor – many people consume diets high in refined foods such as white bread and polished rice which have been stripped of magnesium-rich plant fiber.Magnesium deficiency is not uncommon in hospitalized patients. Up to 12% of all people admitted to hospital, and as high as 60–65% of people in an intensive care unit, have hypomagnesemia.About 57% of the US population does not meet the US RDA for dietary intake of magnesium. The kidneys are very efficient at maintaining body levels; however, if the diet is deficient, or certain medications such as diuretics or proton pump inhibitors are used, or in chronic alcoholism, levels may drop. Low levels of magnesium in blood may be due to not enough magnesium in the diet, the intestines not absorbing enough magnesium, or the kidneys excreting too much magnesium. Deficiencies may be due to the following conditions:

Medications
Loop and thiazide diuretic use (the most common cause of hypomagnesemia)
Antibiotics (i.e.