The following is taken from The 9 Steps to Financial Freedom, by Suze Orman.
Borrowing from your 401 (K)
You may be able to borrow from yourself to pay off your credit cards through your 401 (K) plan at work. Many employers will let you borrow up to 50 percent of the money you have in your plan, up to $50,000, to buy a house or pay off bills or for other situations that qualify. This could be one of the best sources of funds by far if you really are stuck. When you borrow money from a 401 (K), you have five years to pay back the money (rather than the forty years it could take you by paying the minimum on some credit cards). In addition, the interest you pay goes right back to yourself. It's your money, you've borrowed it from yourself, and you're paying it back directly into your account; all the payments plus interest go to you. Usually you will pay yourself about 2 percent above the prime rate, which is the basic interest rate set by the government.
A lot of people will say that if you borrow money from your 401 (K), you are losing out on the growth potential of the money. This is true, and it's a decision to be made cautiously and wisely. Nevertheless, if you are paying 18.5 or 21 percent on your credit cards, and can't transfer to a lower-cost card because of a bad credit report, it might well be better to borrow from yourself at 8 or 9 percent, miss out for a time on that potential groth, and start over again clean.
The prospective downside is that if you happen to leave the job or get fired, the money you borrowed is due in one lump sum at that time. If you can't pay it back, you'll pay taxes on the money as if it were ordinary income, if you're under the age of 59 1/2, you may also have to pay a 10 percent penalty on the amount you haven't paid back. If you are thinking of taking out a loan, and there is a possibility you may leave your current employer, you might want to reconsider your situation before you take out the loan; make sure you understand what you would have to do if you were to leave your job.