1660s, joque, "a jest, something done to excite laughter," from Latin iocus "joke, jest, sport, pastime" (source also of French jeu, Spanish juego, Portuguese jogo, Italian gioco), from Proto-Italic *joko-, from PIE *iok-o- "word, utterance," from root *yek- (1) "to speak" (cognates: Welsh iaith, Breton iez "language," Middle Irish icht "people;" Old High German jehan, Old Saxon gehan "to say, express, utter;" Old High German jiht, German Beichte "confession").
Originally a colloquial or slang word. Meaning "something not real or to no purpose, someone not to be taken seriously" is from 1791. Black joke is old slang for "smutty song" (1733), from use of that phrase in the refrain of a then-popular song as a euphemism for "the monosyllable." Lithuanian juokas "laugh, laughter," in plural "joke(s)" probably is borrowed from German.
-ster
Old English -istre, from Proto-Germanic *-istrijon, feminine agent suffix used as the equivalent of masculine -ere (see -er (1)). Also used in Middle English to form nouns of action (meaning "a person who ...") without regard for gender.
The genderless agent noun use apparently was a broader application of the original feminine suffix, beginning in the north of England, but linguists disagree over whether this indicates female domination of weaving and baking trades, as represented in surnames such as Webster, Baxter, Brewster, etc. (though modern spinster probably carries an originally female ending).
Also compare whitester "one who bleaches cloth;" kempster (c. 1400; Halliwell has it as kembster) "woman who cleans wool." Chaucer ("Merchant's Tale") has chidester "an angry woman" (the 17c. had scoldster). Also compare Middle English shepster (late 14c.) "dressmaker, female cutter-out," literally "shapester," sleestere (mid-15c.) "murderess, female killer" ("slay-ster"). Sewster "seamstress" (Middle English seuestre, late 13c. as a surname, also used of men) is still in Jonson but was obsolete or provincial after 17c. In Modern English, the suffix has been productive in forming derivative nouns (gamester,roadster,punster, rodster "angler," etc.).