Marshallsea Prison was one of Britain's debtor prisons. Basically, creditors could throw their debtors in jail when they felt that they weren't going to pay up.

What I didn't know was that these prisons were for-profit and the people in jail had to pay jail fees. So, it's in the best interest of the prison to farm you out as labor to cooperating companies where the maximum you could make would pay your prison fees and get you out of jail by the time your labor was almost useless.