Berne and Levy's "Physiology" (4th ed.) had the following to say:
"Activities (such as hiking or particularly downhill running) in which contracting muscles are stretched and lengthened vigorously are followed by more pain and stiffness than are comparable efforts such as cycling. The resultant dull, aching pain develops slowly and reaches its peak within 24 to 48 hours. The pain is associated with a reduced range of motion, stiffness, and weakness of the affected muscles. The prime factors that cause the pain are swelling and inflammation that result from injury to muscle cells, most commonly near the myotendinous junction."The type of muscle contractions they're discussing are called eccentric contractions, wherein muscles are contracting and lengthening at the same time, and this type is most likely to cause muscle soreness. This contrasts with concentric contractions, in which the muscle shortens while contracting, and isometric contractions, in which the muscle stays the same length while contracting.
While regular training can help reduce muscle soreness, just a single bout of eccentric exercise will reduce the muscle soreness experienced after a later eccentric exercise bout, even if the events are separated by many weeks (up to 24 weeks in some reports). Possible mechanisms for this acclimation are discussed in these two articles (2nd link is a PDF), though I'm sure there are many more papers on the topic.
One abstract also included the interesting observation that "although training is considered to prevent muscle soreness, even trained individuals will become sore following a novel or unaccustomed exercise bout." Somehow the knowledge that even trained athletes get sore is very comforting right now.