No, it is not legal. A judge has no power to force someone to sponsor another in the context of a divorce. All the judge can determine is the division of assets, spousal support, and (if applicable) child support and custody. You could voluntarily offer to sponsor her in exchange for a reduction in your support payments (if any) or a larger share of assets, but that would be your voluntary choice.