Please consult an elder law attorney re special needs trusts. There are different types of Special Needs Trusts and there are different ages when special needs trusts can be set up. You need an experienced elder law attorney who deals with special needs trusts. I know of no exemption from taxes for withdrawals from 401(k) plans since the contributions are not taxed when they are contributed but rather when they are withdrawn.
You need to speak with an estate planning attorney in your area about setting up a special needs trust.
If the 401k assets are available for distribution under the plan rules then you can take the distribution. It will be taxable to you as income although depending on your age and amount of medical bills you may be able to avoid the 10% early withdrawal penalty. Speak with a tax lawyer or CPA about your eligibility.