Magnesium deficiency is a state of decreased total body magnesium content. The human body contains 21-28 g of magnesium, the majority of which is localized in bone (>53%) and nonmuscular tissue (approximately 19%). Hypomagnesemia (low serum magnesium concentration) is generally defined as serum magnesium <1.8 mEq/L. However, only 1% of magnesium is found in the extracellular fluid, so the serum magnesium level is a poor indicator of the total magnesium content and availability in the body. There is no simple, rapid, and accurate laboratory test to determine total body magnesium status in humans. 
Magnesium deficiency is usually detected because of the resultant hypomagnesemia. However, it may also be revealed by the development of clinical symptoms or associated hypokalemia or hypocalcemia.
Calcium competes with magnesium for uptake in the loop of Henle, and an increase in the filtered calcium load can impair magnesium reabsorption. Hypomagnesemia, in turn, leads to PTH resistance and a decrease in PTH secretion, both of which lead to hypocalcemia.
Hypokalemia is commonly seen in patients with hypomagnesemia, partly because the associated underlying disorders can produce both these disturbances. However, there is also evidence that hypomagnesemia can lead to increased renal potassium wasting.
Patients with abnormalities of magnesium homeostasis typically fall into 1 of 3 groups:
Patients with magnesium deficiency (low total body magnesium content) and a resultant hypomagnesemia (low serum magnesium concentration)
Patients with hypomagnesemia (low serum magnesium concentration) in the absence of magnesium deficiency (i.e., a normal total body magnesium content)
Patients with magnesium deficiency (low total body magnesium content) but no evidence of hypomagnesemia (i.e., a normal serum magnesium concentration).
About 60% of magnesium in the serum is free, whereas approximately 33% is bound to proteins, and <7% is bound to citrate, bicarbonate, ATP, and phosphate. 
Magnesium status is regulated by the intestines, which control absorption; the kidneys, which control excretion; and bone, which is the major storage site. Absorption and excretion are mediated by the selective magnesium channel TRPM6,  whereas magnesium uptake and release from tissues outside the intestines and kidneys is controlled by TRPM7, which has an approximately 60% homology to TRPM6. 
Absorption: magnesium absorption is a saturable process that occurs throughout the small and large intestines, with most of the absorption taking place in the colon. The average daily intake of magnesium is approximately 320 mg in men and 240 mg in women; approximately two-thirds of this amount is eliminated with the feces, while one third is absorbed and passed into the circulation.  Magnesium regulates the expression of TRPM6; a sustained fall in magnesium levels results in increased expression, and increased magnesium absorption.  
Excretion and reabsorption: the major site of reabsorption is the loop of Henle,  although additional reabsorption takes place in the distal convoluted tubule. Approximately 2400 mg/day of magnesium passes through the kidneys, <5% of which is eventually excreted. Since magnesium regulates the expression of TRPM6, a sustained fall in magnesium levels results in increased magnesium reabsorption. 
Although there is no direct hormonal control of magnesium absorption, excretion, and reabsorption, TRPM6 expression appears to be under estrogen modulation.
There is normally very little exchange between intracellular and extracellular magnesium. In the acute phase of a fall in magnesium content, intestinal absorption and renal reabsorption both increase. Hormones such as glucagon, catecholamines, and parathyroid hormone (PTH) can mobilize magnesium from bone and other tissues.  Magnesium, in turn, exhibits negative feedback on catecholamine release. Conversely, hormones such as insulin, antidiuretic hormone (ADH), and thyroid hormone promote magnesium uptake and storage. 
Magnesium is a predominantly intracellular ion and is distributed between the nucleus, endoplasmic or sarcoplasmic reticulum, mitochondria, and cytoplasm.  Approximately 200 enzymes involved in cellular metabolism and the cell cycle require magnesium as a cofactor, including adenyl cyclase and ATPases. Magnesium is also an important cofactor for potassium and calcium channels, and therefore plays a role in regulating action potentials in cardiac and neural tissues, as well as calcium signaling in a wide range of tissues. 
The recommended daily intake of magnesium varies according to age and gender as follows:
Infants: 50-70 mg/day
Children: 150-300 mg/day
Adult females: 280 mg/day normally, increased to 350 mg/day during pregnancy and lactation
Adult males: 350 mg/day.