The first specific reference we have (so far) to what might be a jester concerns a dwarf or a pygmy in ancient Egypt during the reign of Neferkere (Pepi II, r. from c. 2278 BCE). An official wrote to the Pharaoh mentioning a dancing dwarf he had found, and Pepi II responded:
‘Thou hast said in this thy letter that thou hast brought a dancing dwarf from the land of spirits, like the dwarf which the treasurer of the god Burded brought from Punt in the time of Isesi … Come northward to the court immediately; thou shalt bring this dwarf with thee … for the dances of the god, to rejoice and gladden the heart of the king of Upper and Lower Egypt, Neferkere, who lives for ever.’
However, while ‘rejoicing and gladdening the heart of the king’ sounds like a jester’s job description, and while many dwarfs were, or could become, jesters, we should be careful of assuming that the dancing dwarf was one, and that this in any way ‘proves’ the presence of jesters in ancient Egypt. Let’s keep it as a tantalising possibility for now.
In addition, I have recently found references to a Mesopotamian profession, aluzinnu, which may at certain times in its evolution have referred to a jester. If so, then this would apparently be relatively close in time to the Egyptian reference above, with the term first appearing at Mari in the 20th century BCE, with synonyms dating back even earlier to the 24th century BCE. See the review of Maddalena Rumor’s excellent paper.
With these caveats in mind, perhaps the most reliable early example we have at present is from the 7th century BCE, with the Chinese Jester Shi who served the Duke of Xian during the reign of King Huiwang (r. 676-652 BC).
References: Véronique Dasen, Dwarfs in Ancient Egypt and Greece (Oxford: 1993), pp. 25-29 and 133, quoted in Southworth, Fools and Jesters at the English Court (Stroud: Sutton Publishing, 1998), pp. 10-11; Rumor, Maddalena, ‘There’s No Fool Like An Old Fool: The Mesopotamian Aluzinnu and its relationship to the Greek alazôn’, Kaskal: Rivista di storia, ambienti e culture del Vicino Oriente Antico,14 (2017), pp. 187-210; ‘Jinyu’ 晉語, fol. 2, in Guoyu 國語 (Discussions of the States), fol. 8 (Shanghai: Shanghai Guji Chubanshe, 1978), vol. 1, p. 286.