Generally, both parties pay their own attorney's fees and court costs and fees.
However, if one party controls all the money then the judge can order that party to pay the other party's legal fees.
Also, during the divorce if one party "misbehaves" then the judge can order that all or part of the "innocent" spouse's legal fees be paid. It is totally up to the judge.
Talk to a family law attorney in your county for guidance.