As a mineral, magnesium has no calories that can lead to weight gain. It improves your energy levels, sleep patterns, and overall mood, contributing to weight loss. However, magnesium deficiency can interfere with normal body functions. It causes insulin resistance which causes weight gain. Most obese people and overweight people have a magnesium deficiency.