"Take his garment when he becomes surety for a stranger; and for foreigners, hold him in pledge"
This verse is a caution to would-be borrowers. You must have a certain way to pay or you may be reduced to absolute poverty. Do not enter into any kind of debt without careful consideration. When you make a deal that you will pay someone back for a debt, they will hold you to that and they will come to collect their fee even if it means you are left with little.
take his garment
This clearly refers to the last payment for debts that God mentions in terms of loans and repaying a debt. A person was not allowed to take another person's cloak overnight so that person would not spend the night in the cold without any form of covering. Their garment must be returned each evening so that the person would not be completely destitute.
This verse is designed to remind would-be borrowers that they very well may have to sacrifice all that they have – down to their garments – during the day to repay a debt, so don't get into them.
strangers and foreigners
These are people that you do not have any track record with. Solomon seems to be focused on the lack of relational connection with them. Notice that God is saying that while you think it is only money that you are risking with these loans, you are actually risking your own freedom. Unsecured debt puts you at risk.
Be very careful of not embracing a policy of avoidance of debt into your personal life style. IT will come and throw the shackles on us.
We do not think of this very often, but every day people who unwisely borrowed money for a house or car or party or vacation have creditors repossess those items and much more. I have watched as repossession agents have taken people's cars while they were at a fast food joint and left them stranded. I have watched as people have had their houses taken from them. This whole lending and borrowing industry can be very cutthroat and uncaring. Solomon's message is that you should steer clear of it.