There are two types of bankruptcy - a Chapter 7 and a Chapter 13. The latter lasts for up to five years and if you and your spouse were highly adversarial with each other, you would certainly not want to entertain this type of bankruptcy as it would link you together for that time. However, it may be an option if you can collaborate well.
Even if you want to file for a Chapter 7 plan, the ability to work together can help you because you may be able to pursue your bankruptcy together as a married couple before you file for divorce. Again, this is an option not well-suited to couples who cannot cooperate with each other.