And that is also why a magnesium deficiency may cause anxiety. However ... that is caused by the overuse of magnesium-containing medication, states this study, published by Stat Pearls.