There are provisions in the law to allow you to seek to have your spouse pay your legal fees. There are a number of factors that the court must look to but most commonly they look and rely heavily upon discrepancy in income and good or bad faith positions throughout the litigation.
However, I generally advise clients not to expect it because judges don’t grant fees unless it is to enforce an agreement and, even then, they don’t usually award a lot.