For example, were ancient Egyptian laborers still given a food allowance once they were too old to carry pyramid blocks? Were Roman soldiers who lost a limb given the equivalent of a "pension?" Etc.
The oldest laws mentioned in my Poverty Law textbook are the English "Poor Laws" from the 16th century. Are there any examples from the Ancient World of societies taking measures to care for members of society who were considered "deserving" of support?
I am not certain whether this is the oldest, but the Roman state began to sell subsidized grain to the city's poor populous during the second century BC. By the first century BC, this had transformed in large part to a grain dole. This practice continued in one form or another throughout the Republic and early/mid-Empire.
I would strongly doubt that it's the earliest example in all history, but the Islamic Zakat is a form of religiously mandated almsgiving and is attested to in the Quran and the Hadith. As with any aspect of the early Islamic state it would difficult to say with any certainty that the Zakat was actually collected and distributed in any kind of reliable way, but conceptually the idea is clearly present from the earliest period of Islam in the 7th century CE. See for example Sahih Bukhari book 24 from the 9th century and purporting to record the sayings of the Prophet Muhammed from the 7th. Or any of the Quran verses referring to the obligation to give Zakat such as 2:43 or 98:5