If the 401(k) is from a current employer I do not believe you can take a distribution, but you may be able to take a loan. Just be aware that if you lose your job or leave your employer any outstanding balance you do not pay back quickly will be considered a distribution.
If you do take a distribution from the 401(k) of a former employer, it will be taxable. One of the 10% penalty exceptions is "From a qualified retirement plan to the extent you have deductible medical expenses (medical expenses that exceed 7.5% of your adjusted gross income), whether or not you itemize your deductions for the year".
There do not appear to be any 10% penalty exceptions for hardship in IRS Publication 575, since your 401(k) is protected from creditors.