Shakespeare was indeed a naughty little bugger. References to porn, more or less subtle, are found in all of his works. But what greater work than Hamlet! And, indeed, some of Shakespeare's best porn can be found here.

Right at the start, Shakespeare comes off with a resounding innuendo:


BERNARDO: Say,
          What, is Horatio there?
HORATIO:  A piece of him.

I, i, 18

Then things get right steamy, with Ophelia's decription of sex in the closet:


OPHELIA:  My lord, as I was sewing in my closet,
          Lord Hamlet, with his doublet all unbraced;
          No hat upon his head; his stockings foul'd,
          Ungarter'd, and down-gyved to his ankle;
          Pale as his shirt; his knees knocking each other;
          And with a look so piteous in purport
          As if he had been loosed out of hell
          To speak of horrors, he comes before me.

As if that was not enough, Ophelia continues with her graphic descriptions:


OPHELIA: He took me by the wrist and held me hard;
         Then goes he to the length of all his arm;
         And, with his other hand thus o'er his brow,
         He falls to such perusal of my face
         As he would draw it. Long stay'd he so;
         At last, a little shaking of mine arm
         And thrice his head thus waving up and down,
         He raised a sigh so piteous and profound
         As it did seem to shatter all his bulk
         And end his being: that done, he lets me go;

II, i, 76-83, 86-95

During Hamlet's famous soliloquy (To be, or not to be...), it is not too well known, but Ophelia is actually tossing him off under the table. This can be seen by little references he makes to her, that are out of context with what he is currently saying:


ay, there's the rub

III, i, 65

And then, after he is done:


Soft you now!
The fair Ophelia! Nymph, in thy orisons
Be all my sins remember'd.

III, i, 88-89

And just when you thought things couldn't possibly get any worse:


GUILDENSTERN: O, my lord, if my duty be too bold, my love is too unmannerly.
HAMLET: I do not well understand that. Will you play upon this pipe?

III, ii, 322-325