from Wikipedia:
Foreclosures on Credit Records
The legal action of foreclosure may show on a consumer credit report for 7 years from the date of entry (filing).
Here is more detail and input from others:
Seven years from the date it is entered into public records.
The Fair Credit Reporting Act allows the legal action of foreclosure to remain for 7 years from the date of filing.
7 years + 180 days from date of first delinquency.
It will take up to 7 1/2 years to clear a foreclosure from your record
IF you already have a job, you will not lose your job only because you foreclosed on your home.
However, a foreclosure could affect you if you go looking for a new job, or if you lose your current job and need to find a new one. That depends on what kind of job you are applying for. Most employers care more about your work ethics and work habits which they get from speaking to a former employer, not from looking at your credit report.