It's not something you want to think about, let alone plan for. However, it's best to prepare for it now to avoid ending up in unrecoverable debt, or having to take a job that makes you unhappy.
Now is the time to determine how long you could get by on your savings in case you lose your job. Create a net worth statement. A net worth statement is a snapshot of your current financial situation and is also useful for other purposes, such as preparing for major expenses. To create a net worth statement, simply write down the total value of everything you own (savings, real estate, valuable possessions, etc.) and subtract from that total the amount of everything you owe.
Do employees who are laid off from your company receive severance pay? Knowing how much you'd receive if laid off will help you to calculate how much you need to set aside in savings in case you lose your job. Also, find out if you'd be allowed to continue your health insurance benefits if you lose your job.
To stay afloat financially in case you lose your job, and to maintain your good credit rating, try to keep at least three to six months' worth of salary set aside as an emergency fund.
If you do lose your job, contact your credit card companies and other creditors and let them know. They'll appreciate your effort and responsibility. Try to arrange reduced payments during this difficult time. Also, resist the urge to use your credit cards unless absolutely necessary.