The best known modern use of the phrase came from the copper mines of Bisbee, AZ after the turn of the century. The miners we caught in a dispute with the mine operators over pay, safety and working conditions. The phrase came from the fact that the workers were damned if they agreed to the corporate demands and damned if they didn't.
A more graphic interpetation of the phrase is illustrated in the 2010 movie, 127 Hours. Based on a true story, the central character in the movie is miles from civilization. In a freak accident he literally gets trapped between a "rock and a hard spot."
Less dramatic, and certainly more enjoyable, is The Rolling Stones' last top 40 hit, Rock and a Hard Place: