Please follow https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-hardship-distributions.