I looked 'pun' up in the Oxford English Dictionary and found this rather nice quotation from Addison, writing in the Spectator
Having pursued the History of a Punn,..I shall here define it to be a Conceit arising from the use of two Words that agree in the Sound, but differ in the Sense.
You can read the whole article from 1711 here.
I didn't find what I was looking for though. The OED says the word is 'Of uncertain origin'.