When water is referred to as 'hard' this simply means, that it contains more minerals than ordinary water. These are especially the minerals calcium and magnesium. The degree of hardness of the water increases, when more calcium and magnesium dissolves.
Magnesium and calcium are positively charged ions. Because of their presence, other positively charged ions will dissolve less easily in hard water than in water that does not contain calcium and magnesium. This is the cause of the fact that soap doesn't really dissolve in hard water.