Debtor's prison was stupid in that the carrying out of the threat damaged both debtor and creditor (it made the debt worthless). A priori, however, it made sense in that it made credit available to people who had no security to offer other than their bodies.
The same thing might be said of bankruptcy as an institution.