Answer: When a bankruptcy is filed, all lawsuits against the debtor are immediately stayed. If a bankruptcy is filed during a divorce case, the automatic stay applies to the divorce case as well. The divorce Judge may proceed on issues of child support, alimony and custody of children, but may not make any decisions relating to the division of assets and debts without the permission of the bankruptcy court, and any decisions made by the divorce Judge are reviewable by the bankruptcy Judge.
Finishing the divorce action before beginning the bankruptcy filing allows the divorce action to proceed to its natural conclusion without interruption by the bankruptcy court. It is still possible, though, for the Bankruptcy Court to undo the Agreement or Judgment of the Divorce Court if it appears the parties were attempting to defraud creditors (for instance if all of the assets were transferred to the non-debtor spouse rather split equitably). Despite this risk, it is unlikely if the division is equitable that there would be any issue, and both cases would like proceed more smoothly one after the other, rather than simultaneously.
Likewise, there are certain circumstances where it might make more sense to file for bankrutpcy prior to filing the divorce. For instance in a case where both spouses had significant debt, they can file as joint debtors so long as they are still married.
Even if only one of the parties intended to file, there is a recent case which suggests that some of the protections for the debtor extend to the non-debtor spouse (protections that might not apply if the parties are already divorced). For an excellent explanation of this case visit the Bankruptcy Law Network post titled: Actions Taken Against Non-Debtor Spouse Violate Discharge Injunction.
You should consult with an attorney that is familiar with both bankruptcy and divorce law to determine the best course of action in your specific case. The facts of your case, such as the terms of the proposed property settlement or transfers of property under the agreement may be hurtful to your bankruptcy case if you plan on filing for bankruptcy shortly after the conclusion of your divorce matter. Having an attorney that can explain the bankruptcy consequences of your decisions during your divorce will be critical in helping you get your fresh start.