So they set apart Kedesh in Galilee in the hill country of Naphtali, and Shechem in the hill country of Ephraim, and Kiriath-arba (that is, Hebron) in the hill country of Judah. And beyond the Jordan east of Jericho, they appointed Bezer in the wilderness on the tableland, from the tribe of Reuben, and Ramoth in Gilead, from the tribe of Gad, and Golan in Bashan, from the tribe of Manasseh. These were the cities designated for all the people of Israel and for the stranger sojourning among them, that anyone who killed a person without intent could flee there, so that he might not die by the hand of the avenger of blood, till he stood before the congregation. Joshua 20:7-9.
In the old testament system of criminal justice, there is restitution, banishment, shame, corporal punishment and death. But I have never seen incarceration.
It has always seemed better to beat an offender and let him go than it is to warehouse him over time, where the other inmates may exact more punishment that exceeds any lawful penalty. It’s payback without punishing the people who have to pay for his imprisonment.
The city of refuge seems like a humane alternative to the county lockup awaiting trial, where you are effectively being punished before the trial.