A divorcee is living abroad with no one to take care of her maintenance, and the court has ordered her ex-husband to pay indefinite spousal support
Question

I am a divorcee living in Canada. My ex-husband divorced me because I cannot have children. I have no one to support me and no source of income; I am sick and cannot work. My family in Egypt will not let me go back, because they cannot afford the costs for my treatment and living expenses. My treatment is very expensive, and without it my life is in danger. Without me asking, and in light of my situation, the Canadian court ordered my ex-husband to cover my living expenses, accommodation and medical treatment. Is what he gives to me halaal? Please note that whatever is surplus to my needs, I will waive my right to it.
Praise be to Allah.If a man divorces his wife, he is not obliged to spend on her except during the ‘iddah period. When the ‘iddah has ended, he has no obligations towards her, unless she has custody of his children or is breastfeeding them, in which case she is entitled to a fee for custody or breastfeeding, if she asks for that.
Based on that, there is no justification for you accepting any spending on your maintenance from your ex-husband after the ‘iddah has ended, and the ruling of the court that is contrary to sharia does not matter. Anything that you take from him is wrong and is consuming wealth unlawfully, regardless of whether you are rich or poor. Spending on your maintenance, if you are poor and in need, is the responsibility of your family.
The evidence that the ruling of the court does not make what is unlawful permissible is the words of the Prophet (blessings and peace of Allah be upon him): “I am only human. You refer your disputes to me, but one of you may be more eloquent in presenting his case than the other, and I judge in his favour because of what I hear from him. If I allocate to a person something that is his brother’s right, let him not take it, for I have only allocated to him a piece of Fire.” Narrated by al-Bukhaari (6967) and Muslim (1713).
And he (blessings and peace of Allah be upon him) said: “It is not permissible to take a person’s wealth unless he gives it willingly.” Narrated by Ahmad (20172); classed as saheeh by al-Albaani in Irwa’ al-Ghaleel (1459).
And he (blessings and peace of Allah be upon him) said: “Any body that is nourished from haraam sources, the Fire is more appropriate for it.” Narrated by at-Tabaraani from Abu Bakr; classed as saheeh by al-Albaani in Saheeh al-Jaami‘ (4519).
So what you must do is refuse to take this money, and return whatever you took, unless your ex-husband agrees to spend on your maintenance willingly, in which case there is nothing wrong with it.
And Allah knows best.