Dr. Rajab Abu Mleeh, Ph. D. in Shari`ah and a consultant at Islamonline.net website, stated that: Among the serious diseases that have been discussed by past and contemporary jurists is the obsessive-compulsive disorder (OCD), which turns one’s life into an unbearable hell in this world and may spoil his life in the hereafter — May Allah forbid.
Such a disease has several aspects because it may drive a Muslim to doubt his belief in Almighty Allah (exalted be He) by obsessing him and holding sway over his thought until he becomes convinced that he is a believer no more. Thus, persons afflicted with that disease panic, hasten to declaring the Shahadah(testimony of faith), and perform ghusl(ritual cleansing of the body) time after time until they finally despair, believing that they are doomed. Hence, they recant Islam and abandon it altogether.
Anyone might be afflicted with obsessions regarding their ritual purity or their Prayer, doubting whether they have properly performed wudu’(ablution) and Prayer or not. They might even go to answer the call of nature and get out only after the time of the congregational Prayer passes and perhaps even after the time of the Prayer itself passes. Thus, such people turn from living for Islam to living inside bathrooms.

OCD could also drive a person to doubt his Prayer, not knowing how many units of Prayer (Rak`ahs) he has performed, whether he has made the intention (for Prayer) or not, or whether he has uttered Takbirat-ul-Ihram (saying Allah is Greatest at the beginning of Prayer) or not. One, thus, remains in such a condition until he or she relinquishes Prayer at all.

Regarding a divorce word coming from such person, the OCD comes in the form of uttering the word of divorce. It keeps impelling the questioner to utter the word of divorce until he reluctantly does so. The obsessive temptation does not cease until the questioner utters the word of divorce in an attempt to be relieved of such insinuations for a while. Then, one starts another tormenting journey, namely the compunction for ruining the family and for the disunion and spoiling of the children. So what is the ruling of the Islamic Shari`ah on such a divorce?
Before answering the question in hand, we would like to introduce some facts:
1. Almighty Allah (exalted be He) is more merciful to us than our mothers and even than our own selves. Hence, it is inconceivable that He burdens us beyond our capabilities. This meaning is corroborated by many texts in the Glorious Qur’an and the Sunnah. Almighty Allah (exalted be He) says, (Allahintends for you ease, and does not want to make things difficult for you)(Al-Baqarah 2: 185), (Allah does not want to place you in difficulty, but He wants to purify you, and to complete His Favor on you that you may be thankful)(Al-Ma’idah 5: 6) and (Why should Allah punish you if you have thanked (Him) and have believed in Him. And Allah is Ever thankful (of good), All-Knowing)(Al-Nisa’ 4: 147).
2. The OCD sufferer is a sick person, and the rulings applying to the sick in Islamic Fiqhdiffer from those applying to the healthy. In turn, the sick person cannot be treated as the healthy one is treated in regard to Prayer or divorce.
3. The OCD sufferer should seek the means of treating that disease — which are given by Almighty Allah (exalted be He) according to His Established Ways on earth — and adopt such means of treatment until Almighty Allah grants him or her recovery.
4. The OCD sufferers should review the books of Fiqhor consult a jurist who would inform them about preponderant opinions that could make things easy for them until they are relieved of such harmful condition and until they return to their normal state again.
5. The OCD sufferers should not fall prey to the pangs of con
science or suffer self-reproach. They should fully believe that it is Almighty Allah – the Most Merciful, Most Compassionate, Ever-Forgiving, All-Wise and Ever-Affectionate – Who afflicted them with such a disease and that it is He Who can remove such harm and lift such adversity. Allah will not hold them accountable during their sickness for the same as that which He will hold the healthy people accountable for.
6. One should feel assured about their faith and their acts of worship as long as they do their best (to maintain both), and – if Allah wills – they will have a double reward; a reward for the difficulty they encounter and a reward for the work they do.
7. The OCD sufferers should beware of abandoning good deeds under the pretense of their uselessness and of divorcing their wives and separating from them in order to relieve their obsessions, since such is an incitement of Satan and self-talk. Hence, one should have patience and seek the reward from Almighty Allah, exalted be He.
So, the divorce issued by the OCD sufferers is ineffective, whether it be a thought crossing their minds without being uttered or an actual utterance that they clearly pronounce.
Here, Ibn `Abdin reported from Al-Layth that he said regarding the divorce issued by a person who suffers from waswasah (OCD), that it is impermissible. He said: He means the one who is mentally overwhelmed, while “impermissible” means ineffective.
In addition, Ibn Al-Qayyim said in I`lam Al-Muwaqqi`in `An Rabbi Al-`Alamin: If the one issuing divorce is out of his mind due to insanity, unconsciousness or insinuations (obsession), his divorce is ineffective.
Moreover, Sheikh Ibn `Uthaymin said: The divorce made by the one afflicted with waswasahis ineffective, even if he articulates it, in case he does not intend it, since such articulation is involuntarily and unintentionally made by the OCD sufferer. Rather, such a person – being out of his mind – is forced to do it due to the impelling temptations driving him and the lack of resistance against it. For, the Prophet (peace be upon him) said, “No divorce is effective in case of enclosure (i.e. when one is deprived of his wits).”Thus, divorce made by such a person is ineffective in case he does not really and assuredly will it.