Talaaq of one who is mentally ill
Question

I am hoping you can enlighten me as to which way is best for me to proceed.
I suffered from polio at eight months old, this left me completely paralysed for a while but then my strength returned, although my legs were left weak and I was left with a permanent walking problem. Maybe because of this I have been a patient and calm, happy person most of my life, I obtained a degree and worked for a long time.
At the end of last year I was diagnosed with Post Polio Syndrome (PPS) by a specialist Doctor, this basically means in a day I run out of energy quickly and need to pace myself. I am not sure if this is related to PPS but most days I find it difficult to sleep completely through the night. If I do not get enough sleep I become more emotional in a day. Over the last 4 years I have had times when I cry uncontrollably on my own, I loose my temper quickly in family situations.
I have had times when I have thought about suicide and even wrote out my last wishes.
All I could think of was getting out of the marriage as I was nhappy, the same thoughts kept reoccuring, I kept on feeling I needed to get out of the marriage. My children would be  talking to me I wouldnt realise they were talking to me until they shouted or prodded me.
Since then I have attended counselling sessions and I am on anti-depressents as the Doctor said  chemicals in my brain might have got effected over the years.
I make sure I get enough sleep even if this means I wake up late.
I have gradually gone back to being the kind of person I use to be.
After 19 years of marriage with 4 children currently me and my wife live close but we are seperated.
Unfortunately before I realised I was in need of medical help, I issued my wife with Talaqs.
With words similiar to “From me you have Talaq”, on more then two occasions. Mentally I was in a disoriented state, the night before I issued one of the talaqs, I was considering  crashing my car into a lamp post. When I issued the talaq I threw a table in front of me to  the floor. This was really out of character for me as I am a happy and calm person normally.
On two occassions since I read the isitkhara dua, on the night at about 1am on one occassion,  I saw my son asking me to come home. On the second time near the morning I saw my wife.
I was really unwell with depression, sleeping problems and Post Polio Syndrome symptoms including fatigue  that made me disoriented. Can me and my wife continue with married life,
Please can you issue a fatwa in this matter?.
Praise be to Allah.Firstly:
We ask Allah, may He be exalted, to heal you and grant you well-being, and to bless you with happiness and peace of mind.
Secondly:
The basic principle is that if a man divorces his wife (talaaq) when she is in a state of purity during which he has not had intercourse with her, or when she is pregnant, the divorce is valid and counts as such. But Islam overlooks and does not count as valid divorce issued at the time of coercion, as Ibn Maajah (2046) narrated from ‘Aa’ishah that the Messenger of Allah (blessings and peace of Allah be upon him) said: “There is no divorce and no manumission at the time of coercion.” Classed as hasan by al-Albaani.
Al-Bukhaari included a chapter in his Saheeh entitled: Chapter on divorce at the time of coercion and by one who is forced, drunk or insane; errors and forgetfulness in the case of divorce, shirk, and so on, because the Prophet (blessings and peace of Allah be upon him) said: “Actions are but by intention and each man will have but that which he intended”; ash-Sha ‘bi recited (interpretation of the meaning): “Punish us not if we forget or fall into error” [al-Baqarah 2:286]; and what is not permitted of confession from one who suffers whispers from the Shaytaan; the Prophet (blessings and peace of Allah be upon him) said to the one who confessed against himself: “Are you insane?”; ‘Utbah ibn ‘Aamir said: Divorce (talaaq) issued by one who is affected by waswaas (whispers from the Shaytaan) does not count as such. End quote.
Coercion includes being compelled, not being able to think properly, and losing willpower. This happens to the one who is affected by waswaas sometimes, and to the one who has been bewitched, and to some of those who suffer from depression, in such a way that one of them may divorce his wife by compulsion, without choosing or wanting to do so; rather he finds himself pushed or compelled to divorce his wife, and he cannot relax until he speaks of it. In such a case the divorce does not count as such.
Ibn al-Qayyim (may Allah have mercy on him) said: Our shaykh, Ibn Taymiyah, said: Coercion means one is no longer aware of what he is saying and is unable to form an intention. That includes divorce issued by one who is mentally deficient, insane or drunk, one who is forced to do that, and one who is so angry that he does not know what he is saying, because in all of these cases the door has been closed to awareness and intention. Divorce only counts as such if it is issued by one who intends, knowingly, to do that.
End quote from Haashiyat as-Sunan, 6/187
Based on that, if you spoke the word of divorce, understanding it and aware of its impact, and intended to separate from your wife, then this is a divorce that counts as such.
But if you uttered it without realising, under the pressure of your illness and distress, then it does not count as such.
Even if we assume that divorce took place, you have the option of taking your wife back if her ‘iddah has not yet ended, or you can make a new marriage contract with her, fulfilling the necessary conditions, if she agrees to that and if this was the first or second talaaq.
We should point out that if a person divorces his wife three times or more (at one time) by saying “You are thrice divorced” or “You are divorced, you are divorced, you are divorced,” this is to be counted as a single divorce according to the more correct opinion. The same applies if he issues a divorce, then issues another divorce before taking back his wife; this is to be counted as a single divorce, according to the more correct opinion, whether it was on a single occasion or on several occasions, because divorce cannot take place except after doing the marriage contract or after taking back the wife.
For more information please see question no. 96194 and 126549
And Allah knows best.