Ruling on fasting for one who is forced to masturbate
Question

                The fatwa I am asking for is somewhat strange, but the person who is asking needs to know the shar‘i ruling, so we hope that you will not withhold it, because it is a real issue. Even if you are not convinced it is real, we hope that you will give an answer. It has to do with breaking of the fast by one who is forced. I have a friend who I have known for a few years, and he is suffering from having a spell put on him (witchcraft) even though he is a Haafiz and has memorized the book of Allah. He suffers during the month of Ramadan, on an involuntary basis, because on most of the days of Ramadan, the jinni who is controlling him because of the spell tries to force him to break the fast by causing emission of maniy by one means or another. He has tried to stop it happening, but to no avail. This has been happening on most days of the month for several years, and he fasts for the rest of the day without breaking the fast. Even if he tries to make up these days, he cannot because of the spell which is still ongoing and has not stopped.
Praise be to Allah.
    If this brother’s situation is as you describe, then the 
    ruling is that of one who is forced to break the fast. The view of the 
    Shaafa‘is and Hanbalis is that in the case of one who is forced to break the 
    fast by having intercourse, eating or drinking, if the one who is forced 
    does that, it does not break the fast and he does not have to make it up, 
    unless the compulsion to break the fast was by means of zina, according to 
    the Shaafa‘is. (al-Mawsoo‘ah al-Fiqhiyyah, 28/58). 

    This view is the closest to what was narrated by Ibn ‘Abbaas 
    (may Allah be pleased with him), that the Prophet (blessings and peace of 
    Allah be upon him) said: “Allah has pardoned my ummah for mistakes, what 
    they forget what they are forced to do.” Narrated by Ibn Maajah (2045); 
    classed as saheeh by al-Albaani in Takhreej al-Mishkaat (6248). And 
    because in the case of compulsion there is no choice, and it is worse than 
    forgetting, and the one who forgets does not break his fast according to the 
    correct view, then being forced to break the fast is less serious than being 
    forced to utter words of kufr, and the one who utters words of kufr under 
    compulsion does not become a kaafir. 

    Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: If 
    a person is forced to do anything that breaks the fast and does it, there is 
    no sin on him and his fast is still valid, because Allah, may He be exalted, 
    says (interpretation of the meaning): “And there is no sin on you if you 
    make a mistake therein, except in regard to what your hearts deliberately 
    intend. And Allah is Ever OftForgiving, Most Merciful” [al-Ahzaab 33:5]. 
    And because Allah has ruled that no one is a kaafir who is forced into kufr, 
    so with regard to that which is less serious than that, it is more apt that 
    there should be no sin on them. And because the Prophet (blessings and peace 
    of Allah be upon him) said: “My ummah has been pardoned for mistakes, what 
    they forget what they are forced to do.”

    End quote from Majmoo‘ Fataawa al-Shaykh Ibn ‘Uthaymeen, 
    19/207 

    We ask Allah, may He be exalted, to heal your friends and 
    grant him well being. We advise him to persist in performing ruqyah, 
    offering a great deal of supplication (du‘aa’) and giving charity, because 
    these are the  means of healing and relieving calamity. Also remind him to 
    be patient and seek reward with Allah, because Allah, may He be glorified 
    and exalted, tests His slave with whatever He wills, to expiate his bad 
    deeds or raise him in status. The Prophet (blessings and peace of Allah be 
    upon him) said: “Nothing befalls the believer of disease, affliction, 
    distress, grief or harm, even a thorn which pricks him, but Allaah will 
    cause it to expiate some of his sins.” Narrated by al-Bukhaari (5642) and 
    Muslim (2573). 

    And Allah knows best.