As a general statement of law that is not correct. It is true for some states but not others. For example, you'd be correct for a divorce case in Nebraska, as the Supreme Court of that state held that "For all of these reasons, we hold that a trial court does not have discretion to compel parties seeking marital dissolution to file a joint income tax return." Bock v. Dalbey, 283 Neb. 994, 1004, 815 N.W.2d 530, 538 (2012).
But NJ courts have a different rule:
As a result, we hold that trial courts in New Jersey have discretionary authority to compel parties in divorce proceedings to file joint tax returns. Whether it is appropriate to compel that result will depend upon the facts presented in any given case. In general, we believe trial courts should avoid compelling parties to execute joint tax returns because of the potential liability to which the parties would be exposed, and because there generally exists a means by which to compensate the parties for the adverse tax consequences of filing separately.
Under the circumstances presented in this case, we perceive no abuse of discretion on the part of the trial court in compelling the parties to file joint returns.
Bursztyn v. Bursztyn, 379 N.J. Super. 385, 398, 879 A.2d 129, 137 (App. Div. 2005).
Iowa, too, allows the courts to order the spouses to file a joint return:
Maura contends the district court acted inequitably in requiring her to cooperate with Brian in filing a joint tax return for the 2012 taxable year. We disagree.
The district court was authorized to consider the tax consequences to the parties. See Iowa Code § 598.21A(g). Here, the consequences were significant. The district court found the parties filed separate *861 income tax returns for the 2012 tax year but if they amended the returns to file jointly, “they could save approximately $16,000.” This finding is supported by the record.
Significantly, the Iowa Supreme Court has affirmed the concept that “neither party should have sole discretion with regard to tax filings after separation because the filings might adversely affect the other party.”
In re Marriage of Witherly, 867 N.W.2d 856, 860–61 (Iowa Ct. App. 2015).
In short, the states are split on whether a court may order parties to a divorce to file joint income tax returns for years in which they are eligible to do so. So there isn't a one size fits all statement of the law here that will apply to all states.
And what about Arizona, where the OP is located? I did not find any appellate court decisions that directly address the issue, though my research was not completely exhaustive. But I did find at least one appellate case in which the court noted that the trial court had ordered the couple to file joint returns. "As discussed, the Decree directed Husband to pay Wife $4,100 no later than January 31, 2012. It also required the parties to file joint federal and state income tax returns for 2010." Freeman v. Freeman, No. 1 CA-CV 12-0356, 2013 WL 1932912, at *3 (Ariz. Ct. App. May 9, 2013). So apparently such orders are issued in that state. As to what the Arizona appellate courts would say if squarely presented with the question as to the trial court's authority to do that, I can't say. The courts could go either way. A family law attorney in that state would have a better grasp of which way that state's courts would go, and I suggest the OP consult a family law attorney on the matter to get a feel for how that might go and, should the OP want to contest the matter, what that will cost.