A water softener is a substance that can reduce calcium and magnesium ion concentrations in hard water. It typically does this by binding with the ion to prevent it from binding with anything else.
Hard water contains dissolved calcium and magnesium ion from limestone and other sediments, which can change the pH level of the water and cause it to react with soaps poorly or to precipitate out and build up a lime deposit, especially in hot water. Lime deposits can build up over time and restrict water flow, which can in the wrong circumstances lead to catastrophic failures of systems.
Water softeners depend on an ion-exchange resin where hard ions trade places with sodium ions. A group of minerals called zeolites can provide ion exchange, and were commonly used in early water softeners.
In a water softener, the water passes through a bed of resin. The negatively-charged resins absorb and bind positively-charged metal ions; sodium ions previously held by the resins are attracted away by magnesium and calcium ions, and bind with them. This creates water that is no longer hard, but rather has a low level of mineral salt, which will not precipitate or react badly with detergents.
Web Resources On Water Softener
HowStuffWorks: Water Softener
How It Works: Water Softener
Book Resources On Water Softener
Effects of a soap, a detergent, and a water softener on the plasticity of earth materials by William Arthur White
Leaching of metals from household plumbing materials impact of home water softeners by Thomas J. Sorg