Do you have to be married to file a joint bankruptcy petition?

Yes.

11 U.S. Code § 302 – Joint cases states that

(a) A joint case under a chapter of this title is commenced by the filing with the bankruptcy court of a single petition under such chapter by an individual that may be a debtor under such chapter and such individual’s spouse. The commencement of a joint case under a chapter of this title constitutes an order for relief under such chapter.
(b) After the commencement of a joint case, the court shall determine the extent, if any, to which the debtors’ estates shall be consolidated.

Simply put, there must be a debtor plus a debtor’s spouse to file a joint bankruptcy petition.

However, the word “spouse” is nowhere defined in the Bankruptcy Code.

We can assume that it means lawfully married, but whether this means man and wife, a civil union, a domestic partnership, or a common-law spouse is up for interpretation.

I recently had a couple who had been in a common-law marriage for the past 28 years.  They had the same last names, both were on title for the home and on the hook for the mortgage, and they had the same assets and debts.  I advised them to file a joint bankruptcy petition.  If the trustee objected to the “joint” nature, I was prepared to argue that for all intents and purposes, they were “spouses” under bankruptcy law.  If I was wrong, we would probably have to bifurcate (split) the case, pay an additional filing fee of $335 to the court, and then they would both have separate but identical cases.

This may be problematic here in Utah, since Utah adds a requirement to common law marriage that many states do not have:  you must have it recognized by a court as a lawful marriage.  Nonetheless, I was prepared to make the argument in good faith, if necessary.