Dr. Briden adds that magnesium deficiency in women could cause contractions in the body's smooth muscles and increase period pain. The best way to get magnesium is by eating foods such as leafy greens, almonds, legumes, and whole wheat; you can also take magnesium supplements, but consult a doctor first.