If I leave the company, what happens to the money that has been deducted from my paycheck to purchase ESPP shares?
You will continue to own stock purchased for you during your employment, but your eligibility for participation in the plan ends. Any funds withheld from your salary but not used to purchase shares before the end of your employment will be returned to you, normally without interest, within a reasonable period.
For plans that are tax-qualified under IRC Section 423, the tax code permits your company to keep the pre-termination payroll deductions in the plan to purchase shares when the purchase period ends (and purchase occurs) no more than three months after the termination date (12 months for disability). However, most plans do not permit this, because the ESPP is intended to be a benefit for current employees.
This means that if your employment ends before the purchase date, under most plans shares are not purchased for you on a pro rata basis. This applies even if employment ends for reasons other than job loss, such as death, disability, or retirement.
Example: Before you left your company, salary deductions occurred for two months, with a six-month ESPP offering period. The money that you paid is not saved for purchase to the six-month point.