Earlier quoted context omitted.
IIRC incarceration was a method started by christian monks, and the intention was that the incarcerated would use the time to reflect and contemplate his crimes - a form of rehabilitation. As you say, that certainly isn't what's happening today. Instead it gives criminals a broader network, and my impression is that it works sort of like a "crime school". But the US method of privatizing and profiteering off of impri…
The Bible records Joseph as being put in prison in Egypt c.1500 BCE. Peter is imprisoned in the NT c.30 CE. Perhaps you meant incarceration with a view to rehabilitation?
Newer evidence strongly suggests the exodus took place during Egypt’s Middle Kingdom (c. 1450), dating Joseph’s deportation and rise to power at roughly 1900 BCE.