Prisons, as we understand them today serve the purpose of depriving an individual of their liberty; that idea of liberty did not exist at the time that you refer to. The liberty of an individual to live their life as they see fit within the restraints of the law is a modern concept, therefor the idea of punishing a person by depriving them of something of which they were not in possession of did not arise.
In addition it would be hard to conceive as punishment a regime whereby offenders were taken to a place, fed, clothed and housed all at the states expense when such largesse on the part of the state was not offered to those in society who had committed no crime.
Where such institutions as we might describe as prisons existed, to be incarcerated in such a place was not, in itself, the punishment. People in such places would be held there in order that they could fulfil their role as slaves or forced labourers or until such time as some other appropriate punishment could be carried out. Ancient law as based up the notion of ‘an eye for an eye’, that is retribution, where that retribution should seek to redress the loss felt by the victim of the crime. An eye for an eye can just as well be understood as, ‘a sheep for a sheep’ if a sheep has been stolen or ‘a son for a son’ if a person has been found guilty of murder. The act of cutting of a limb in the cases of theft is as much to do with preventing any future theft on the part of the guilty as it is with any sense of punishment. Such practises were the expedient and pragmatic approach to justice by a society that did not conceive of and therefor value liberty such that any loss of it could be considered punishment.