From IRS tax topic which describes the circumstances where there is no 10% penalty on early withdrawl:
The following five exceptions apply to distributions from any qualified retirement plan:
1. Distributions made to your beneficiary or estate on or after your death.
2. Distributions made because you are totally and permanently disabled.
3. Distributions made as part of a series of substantially equal periodic payments over the life expectancy of the owner or life expectancies of the owner and the beneficiary. If these distributions are from a qualified plan other than an IRA, you must separate from service with this employer before the payments begin for this exception to apply.
4. Distributions that are equal to or less than your deductible medical expenses, that is, the amount of your medical expenses that is more than 7.5% of your adjusted gross income. You do not have to itemize to meet this exception. For more information on medical expenses, refer to Topic 502.
5. Distributions made due to an IRS levy of the plan.
The following additional exceptions apply only to distributions from a qualified retirement plan other than an IRA:
1. Distributions made to you after you separated from service with your employer, if the separation occurred in or after the year you reached age 55,
2. Distributions made to an alternate payee under a qualified domestic relations order, and
3. Distributions of dividends from employee stock ownership plans.
The following exceptions apply only to distributions from IRAs:
1. Distributions equal to or less than your qualified higher education expenses,
2. Distributions made to pay for a first–time home purchase, and
3. Distributions made to pay health insurance premiums if you are unemployed.