And it's all based on one very simple sound shift: the pronunciation of 'whore' as [ʔoɹ] you'll notice two things about it, the 'h' drops at the beginning - 'h' often dropped in the uh, in Early Modern English in that way, and you get this other change, 'hour' in Modern English becoming [ʔoɹ] in the earlier version, and the combination of the two changes together produces a coming together of the two words and therefore a perfect pun. 