Magnesium usually makes up about 1/3 of the total hardness of most water. It is found in many minerals, including dolomite and clay. It is very abundant in sea water—usually five times the amount of calcium. It is seldom a significant problem, but it is removed along with calcium when hardness is treated.
Magnesium is readily removed by cation exchange (water softener). Reverse osmosis also removes magnesiuim.
Photo source: WikiMedia, author: Warut Roonguthai
(whole house & well units)