Based off of the information from these Wikipedia articles (which are probably not exhaustive, of course), it seems Plato's Republic was the first compelling ideology which could be classified as socialist, and the reign of Emperor Chandragupta of the Mauryan Empire could be called the first truly socialist state.
The economy of the 3rd century BCE Mauryan Empire of India, under the rulership of its first emperor Chandragupta, who was assisted by his economic and political advisor Kautilya, has been described as," a socialized monarchy", "a sort of state socialism", and the world's first welfare state.[15] Under the Mauryan system there was no private ownership of land as all land was owned by the king to whom tribute was paid by the Shudras, or laboring class. In return the emperor supplied the laborers with agricultural products, animals, seeds, tools, public infrastructure, and stored food in reserve for times of crisis.[15]
[15] Roger Boesche (2003). The First Great Political Realist: Kautilya and His Arthashastra. Lexington Books. pp. 67–70. ISBN 978-0-7391-0607-5.
https://en.wikipedia.org/wiki/History_of_socialism#In_antiquityI'm sure we can find something older than that. The Wikipedia articles and communist archaeologists/historians seem to mostly have focused on the "communalist" aspects in their research, rather than the statist welfare aspects.
The description of generic "ancient Egyptian" society is similar:
Ideas and political traditions that are conceptually related to modern socialism have their origins in antiquity and the Middle Ages.[6] Ancient Egypt had a strong, unified, theocratic state which, along with its temple system employed peasants in massive labor projects and owned key parts of the economy, such as the granaries which dispensed grain to the public in hard times.[7] This system of government is sometimes referred to as 'theocratic socialism".[8]
https://en.wikipedia.org/wiki/History_of_socialism#In_antiquity----
There are also various articles about types of religious socialism, but they seem to mostly be about "unorthodox" Marxists who have re-embraced religion, rather than examination of historic practices.
https://en.wikipedia.org/wiki/Religious_socialismhttps://en.wikipedia.org/wiki/Religious_communismhttps://en.wikipedia.org/wiki/Christian_socialismhttps://en.wikipedia.org/wiki/Christian_communismhttps://en.wikipedia.org/wiki/Christian_anarchismhttps://en.wikipedia.org/wiki/Islamic_socialismhttps://en.wikipedia.org/wiki/Buddhist_socialism