Hard water forms when water passes through deposits of minerals like calcium and magnesium in the earth, dissolving small amounts. The higher the concentrations of calcium and magnesium, the harder the water. Hard water interferes with soap's ability to lather and causes more soap residue due to interactions between minerals in the water and soap. It can also lead to mineral deposits in appliances like dishwashers and washing machines over time, shortening their lifespan.