John Gill's Exposition of the Whole Bible
Proverbs 22:27
If thou hast nothing to pay,.... When the debtor this, and the creditor demands the debt of the surety: it is weakness in a man to be a surety for another, when he knows he is not able to pay the debt he is bound for, since it may be an injury to himself and family; but it is a piece of wickedness to engage for the payment of a debt, in case of insolvency, which he knows he is not able to answer; for this is deceiving and imposing upon the creditor; and therefore it is no wonder, being provoked by such ill usage, if he goes to extremity, as follows:
why should he take away thy bed from under thee? as in all likelihood he will, being irritated by such a conduct; and as he might, notwithstanding the law in Exodus 22:26; for that respects a pledge, and not a debt; and raiment pledged, the covering of a man when in bed, and not the bed itself; for even wife and children might be taken for debt, 2 Kings 4:1. This is said to deter from suretyship, especially in such circumstances; since a man may bring himself into such a condition as not to have a bed to lie on; yea, to have it taken from under him when upon it; and be turned out from house and home, naked and destitute.