Your body needs magnesium for brain, heart and muscle function and hundreds of enzymatic reactions, including energy production and protein formation.