1660s, joque, "a jest, something done to excite laughter," from Latin iocus "joke, sport, pastime," from PIE root *yek- "to speak" (cf. Breton iez "language," Old High German jehan "to say," German Beichte "confession").
Originally a colloquial or slang word. Meaning "something not to be taken seriously" is 1791. Practical joke "trick played on someone for the sake of a laugh at his expense" is from 1804 (earlier handicraft joke, 1741). Black joke is old slang for "smutty song" (1730s), from use of that phrase in the refrain of a then-popular song as a euphemism for "the monosyllable."