In order to shave, you need a sharp knife of some sort to do the shaving. Although you can use an ordinary knife to do the job (see, for example, the movies Tarzan and Dances with Wolves, among others), the best knife for the job is a straight razor.
(See How Sword Making Works for many more details on the metallurgy and technique of making fine blades.)
If you have ever watched an old movie or cartoon that features a straight razor, you have probably seen the sharpening stone, and you have certainly seen the leather strop used to hone the blade to razor sharpness. Sharpening a straight razor is actually a fine art, as you can see if you look through these sharpening instructions.
A blade goes from sharp to dull because the sharp edge wears away. Atoms of metal at the keen edge of the blade chip off. The sharpening stone recreates the wedge shape at the tip of the blade. You actually abrade the metal with the stone to bring the edge of the blade to an atom-slicing point. By pushing the edge of the blade into the stone, the stone can carve away the metal and create a sharp wedge.
However, the stone will leave a bit of microscopic roughness on the sharp edge of the blade. You take this roughness out by using the strop. Here you run the blade on the leather in the opposite direction that you used on the stone. The idea is to align the microserrations on the edge of the blade and bring the blade to maximum microscopic sharpness.
Doing all this honing and stropping is an art, and it takes a lot of time. Creating a smooth, razor-sharp edge is not easy. Add to this the fact that using this long, exceedingly sharp razor blade on your skin is inherently dangerous. If all you have is a straight razor, it is no wonder that people preferred to let their beards grow.
The development of the safety razor changed all of that. We'll talk about it next.