My first thought (probably yours) is that the two of them had been imprisoned for debt.
I can at least sketch out what I have found for my (presumed) 4G GF Henry Marley (abt 1781 - 1853), who was imprisoned for debt in Bristol in 1840 and 1846 or thereabouts. Quite how much transfers, I don't know.
The first thing to note is that the Charles Dickens inspired picture of debtors flung into prison for the rest of their lives is - at least for my ancestor - nonsense at this period. Next thing is to note that bankrupts and insolvent debtors are, at this time, different, and the Walters brothers are probably the latter. There are 2 TNA Guides Looking for records of a bankrupt or insolvent debtor and Bankrupts and insolvent debtors: further research which may help. The difference between the two is that bankrupts were traders owing at least £100 who couldn't pay, while insolvent debtors had private debts.
Crucially, once a bankrupt has had their assets liquidated, then the money goes to pay off their creditors and if they only get 6 pence in the pound back - that's it, that's all they get and the bankrupt can be discharged. But an insolvent debtor can never be discharged until they have paid off all their debts. Insolvent debtors were originally imprisoned, which, to say the least, hampered their ability to pay off debt. Eventually a "Court for Relief of Insolvent Debtors" was created and when the insolvent debtors surrendered their property, they could be released from prison - subject to the agreement of their creditors. However, they were not discharged from their debts, subsequently acquired property remaining liable to claim by their creditors.
The TNA Guide referred to gives various possibilities for information. Most of my sources for Henry Marley's debts come from newspaper references, usually when he was applying to be released from prison - the London Gazette seems a good source. For example:
Court for Relief of Insolvent Debtors
Saturday the 20th day of June 1840
Orders have been made, vesting in the Provisional Assignee the Estates and Effects of the following Persons:
(On their own Petitions)
...
Henry Marley, late of Great Ann street, Bristol, Currier. - In the Gaol of the city of Bristol.
...
"Insolvent Debtors" looks like a good search term. One of the local papers the Bristol Mercury also has notices relating to requests for release. However, all these notices are fairly formulaic - they may add enough in terms of occupation and address to confirm who the debtors are but seldom seem to explain why the debt arose.
I did try to work my way through the TNA records in the B8 and B6 series for Henry Marley. B8 is an index. I found his case in the B6 files but there isn't much there - just data about the gaol, name, occupation, and dates relating to his petition for release.
The detail about the original imprisonment is held - I am told - in court records at Bristol. They are not in the Quarter Sessions records (I think this is a typical place for them elsewhere) but in the records of Bristol's Court of Requests which dealt with small debts. The Archivist did find the case in those records - I've not seen the records myself yet but she did describe the records as "not very informative". They did, nevertheless, state who the creditor was and the amount owed (£4 11s 6d).
My impression is that there's unlikely to be much more than this for Henry, at least.
Given the existence of the Court for Relief of Insolvent Debtors, I am wondering how much justification there is for the Dickensian view of imprisonment for life, which even infects the TNA Guide.