How do we know that divorces are more "costly" to society than people being stuck together even if they aren't happy together? Would seem like the opposite to me.
That's a different question though. It's in society's interest to ensure couples (or at the least couples who have children) are compatible enough long-term to not end up divorcing/separating.
The societal costs otherwise aren't just the obvious direct costs - there are other things like (in divorces where there are children involved) negative effects on labour force mobility.
Maybe better to put it as "emotionally unhealthy relationships" are costly to society. Singlehood is also less economically 'optimal' than partnerships, and divorce combines some of both.
Both are bad, and I actually put the later in the “toxic relationship ” category above.
There are many situations for which a divorce is better than staying in a bad mariage, but divorce are still obviously costly for society: it drives the housing demand up, the legal process is costly and encumbers courts, single-mom households are more prone to poverty and its negative effects, etc.
The key point is that ideal for individuals (a couple that is happy together) is also the ideal for governments.
The societal costs otherwise aren't just the obvious direct costs - there are other things like (in divorces where there are children involved) negative effects on labour force mobility.