It is rare for an employer to fire an employee because they filed for bankruptcy.
Employers may not fire you solely because you filed for bankruptcy. If your employer did fire you for filing bankruptcy, it would be a direct violation of the bankruptcy laws. The bankruptcy court enforces the bankruptcy laws, and the court could punish an employer for violating the law. The important word here is “solely.”
Filing for bankruptcy will not protect you from being fired from your job for other reasons. Normally, when someone is fired it is because they have violated the employer’s rules, or engaged in conduct that was disruptive to the company. Sometimes, an employee is fired because they have proven to be unable to do the job as well as the employer requires. If you are in danger of being fired for reasons of that nature, and you are then fired after filing for bankruptcy, you may find it impossible to prove that the reason you were filed was that you filed for bankruptcy. Your employer would probably deny that the bankruptcy case had anything to do with why you were fired, and if there were other grounds for firing you, the bankruptcy court might agree with the employer.
When an employer does have other reasons to fire you, you were probably going to be fired even if you did not file for bankruptcy. If so, that job was not a good fit for you, and both you and your employer might be better off if you found a new job. If there are no other reasons why your employer would fire you, it would be very unusual for your employer to fire you solely because you filed for bankruptcy.
In many ways, filing for bankruptcy is a sign of being a responsible person, someone employers like to have on the job. By filing for bankruptcy, you are taking control of your finances, getting a fresh start in your financial life. Putting financial problems behind you can improve your outlook on life, allowing you to focus on being a productive member of the community. Few employers would choose to judge you harshly for taking such a positive step.