There are many scenarios under which it makes sense to file Bankruptcy before divorcing. If you and your spouse can agree to file a joint Bankruptcy case before the divorce, and you both qualify for a Chapter 7, you can eliminate the debts and have less to argue about in the divorce.
If your spouse doesn't want to file Bankruptcy, you may want to wait until after the divorce is final so you know how the debts will be divided in the divorce. Child support, maintenance (alimony), and other "domestic support obligations" cannot be discharged in Bankruptcy. For instance, if the divorce court orders you to pay your ex's car payment as a form of domestic support or alimony, you cannot discharge this debt in Bankruptcy. Whether a debt from your divorce is considered a "domestic support obligation" and therefore not dischargeable is a complicated legal question. If you are considering both divorce and Bankruptcy, you should consult with qualified attorneys on each issue before deciding on the timing of your actions.