I'm not sure what you mean by "explain why the formation of magnesium hydroxide enables magnesium". Magnesium hydroxide can be converted to magnesium oxide by calcination.
To distinguish between barium and magnesium chloride - dissolve a small amount of each salt in water or dilute hydrochloric acid and add a few drops of dilute sulfuric acid, barium sulfate will precipitate, magnesium will not.
Dissolve a small amount of calcium sulfate in dilute hydrochloric acid, add a couple of drops of barium chloride solution - barium sulfate will precipitate.
The hardness of water is associated with the total dissolved solids, but can be related to the amount/concentration of calcium ions.
Most of this information can be found in a Qualitative Inorganic Chemistry text book.