If you and your spouse can reach a separation agreement, it should set out who pays the costs of obtaining a divorce order. For example, it may state that the spouses will equally share the cost, or that the spouse who applies must pay.
It is also worth noting that in contested divorce proceedings, the court can award “costs” to the winning party after a step in the proceeding or after the trial itself. These court-ordered costs will cover some but not all of your legal fees and expenses.