Compression happens at various stages in the mix and master. In this case, it's the mastering stage we have to worry about.
There's a lot of compression involved in vinyl. But it tends to be more band-limited, since vinyl is lousy at reproducing high and low frequencies. And it's not really in service of loudness, it mostly rolling off of some frequencies, stereo width, etc so the lathe and the needle will track. Vinyl actually has a *lower* available dynamic range than CD, in practical terms, because of the limitations of a needle. (play back with a scanning tunnelling microsocope, though, and WOW fidelity!
Because CD/Digital can handle much louder singals, a master for digital can run a lot hotter, and with a lot more high and low frequency information. What some people call "digital harshness" may just in fact be "those frequencies over about 15khz we had to roll off for the vinyl." Now of course, this can be entirely abused, and starting around the 80's, record execs started pushing mastering engineers to make it louder, and make it stand out more - so we'd get things like high-loudness heavily-limited tracks with a lot of high-end harmonic exciting done to it, so a track would sound bright and loud compared to its neighbors on the radio.
It was an arms race, but it wasn't a requirement of the digital medium, just a requirement of the people running the industry (and let me just say, mastering engineers aren't fond of it either...they like undamaged hearing...but we've all got bills to pay).