Under conditions of mental or physical stress, magnesium is released from your blood cells and goes into the blood plasma. From there, it's excreted into the urine.
Chronic stress depletes your body of magnesium, leading to magnesium deficiency symptoms. The greater your level of stress, the greater the loss of magnesium.
The lower your initial magnesium level is, the more reactive to stress you become, and the higher your level of adrenaline in stressful situations. Higher adrenaline causes greater loss of magnesium from cells, creating a vicious cycle.