"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.
At the revival of learning, and the spread of what we may term the refinement of society, punning was one of the few accomplishments at which the fine ladies and gentlemen aimed. From the twelfth to the sixteenth century, it was at its greatest height. The conversation of the witty gallants, and ladies, and even of the clowns and other inferior characters, in the comedies of Shakespeare and his contemporaries, which we may be sure was painted from the life, is full of puns and plays upon words. The unavoidable result of such an excess was a surfeit, and the consequent dégout, which lasted for more than a century. Like other diseases, it broke out again subsequently with redoubled virulence, and made great havoc in the reign of Queen Anne. [Larwood & Hotten, "The History of Signboards from the Earliest Times to the Present Day," London, 1867]