The most common reason to add salt to water when hard boiling an egg is to the increase the temperature of the water for better cooking. Evidence also suggests that salted water prevents an egg from cracking.
The boiling point of water is 100 C or 212 F. Adding a water-soluble material such as salt or sugar increases the boiling point. When cooking savory foods, salt is generally used.
An egg that cracks in hot water can cause stringy pieces of albumen to appear. If an egg cracks, salted water (as well as vinegar) can help the egg white coagulate more quickly.
Because salted water cooks at a higher temperature, it can produce boiled eggs with a more "rubbery" texture. Soft-boiled eggs call for a more subtle, even simmering, and generally do better without salt.