"a Conceit arising from the use of two Words that agree in the Sound, but differ in the Sense" [Addison]; "An expression in which the use of a word in two different applications, or the use of two different words pronounced alike or nearly alike, presents an odd or ludicrous idea" [Century Dictionary]; 1660s (first attested in Dryden), a word of uncertain origin.
Perhaps from pundigron, meaning the same thing (though attested first a few years later), itself a word of uncertain etymology, perhaps a humorous alteration of Italian puntiglio "equivocation, trivial objection," diminutive of Latin punctum "point." This is pure speculation. Punnet was another early form.
Pun was prob. one of the clipped words, such as cit, mob, nob, snob, which came into fashionable slang at or after the Restoration. [OED]
The verb, "to make puns," also is attested from 1660s, first in Dryden. Related: Punned; punning.