The answer to this question will depend on the nature of the hostile work environment. First, it is important to understand that an unpleasant place to work, or a cranky boss who treats you and others poorly and similar types of circumstances do not necessarily constitute a hostile work environment per se. In essense, employees do not have the right nor the legal expectation of enjoying employment in a pleasant, well-run, respectful, workplace. Similarly, there is no obligation on employers to make sure employees get along, or even to treat employees with respect themselves.
That means that if you’re having conflict with supervisors or coworkers, or perhaps disagreeing with workplace rules or policy, unfortunately, you most likely won't have any recourse. You may leave the job, but if you leave, your resignation will most likely be considered voluntary. Since voluntarily leaving a job renders one ineligible for unemployment, if you leave a job of your own free will, you cannot collect unemployment insurance.
However, under certain circumstances, a hostile work environment might mean that you were constructively discharged, and if so, you may be eligible for unemployment insurance. These circumstances include:
In the above cases, it is possible (especially if your health or safety was on the line) that your leaving “voluntarily” would be considered to be excused and you’d be eligible for unemployment insurance. It’s also possible that you’d have other claims or compensation to which you’d be entitled, such as a job discrimination or harassment claim, or a whistleblower claim. If you believe that one of the situations above applied, then you should consult with an employment attorney, who could both advise you as to your eligibility for unemployment insurance and also let you know if you may be entitled to other compensation.