Praise be to Allah.and blessings and peace be upon the Messenger of Allah and his family and companions.
Undoing the effects of witchcraft on one who has been bewitched means that one of the following two scenarios must apply:
1 – That the ruqyahs (incantations) prescribed in sharee’ah (Islamic law) and the prayers for refuge with Allah that are narrated from the Prophet (peace and blessings of Allah be upon him) and permissible medicines are used. There is nothing wrong with this, but one must be careful to adhere to the guidelines prescribed in Islam with regard to ruqyah. See question no. 12918.
2 – That the witchcraft is treated by means of witchcraft, which means getting close to the jinn by means of offering sacrifices and other acts of worship. This is not permissible, because this is a devilish action, and indeed it is major shirk (polytheism) and we must avoid it. Similarly it is not permissible to treat the problem by asking fortune-tellers, soothsayers and magicians for help and doing what they say, because they are not believers and they are liars and evildoers who claim to have knowledge of the unseen and who deceive people. The Messenger of Allah (peace and blessings of Allah be upon him) warned us against going to them and believing what they say. He (peace and blessings of Allah be upon him) said: “Whoever goes to a fortune-teller and asks him about something, his prayer will not be accepted for forty days.” And he (peace and blessings of Allah be upon him) said: “Whoever goes to a soothsayer and believes what he says has disbelieved in that which was revealed to Muhammad (peace and blessings of Allah be upon him).” The practitioners of witchcraft are kafirs (disbelievers) and it is not permissible to go to them or to ask them about anything or to believe them.
It was narrated in a saheeh (authentic) report that the Messenger of Allah (peace and blessings of Allah be upon him) was asked about nashrah. He said: “It is the work of the shaytan.” [in his Musnad, Abu Dawood] Nashrah means undoing witchcraft by means of witchcraft. What the Prophet (peace and blessings of Allah be upon him) meant by nashrah is that which the people of the Jahiliyyah (pre-Islamic days of ignorance) used to do, when they would ask the practitioners of witchcraft to undo spells, or undoing witchcraft by means of a spell from another practitioner of witchcraft.
With regard to undoing witchcraft by means of ruqyah and prayers for refuge with Allah as prescribed in sharee’ah, and permissible kinds of medicine, there is nothing wrong with such methods. This was stated by Ibn al-Qayyim and Shaykh ‘Abd al-Rahman ibn Hasan in Fath al-Majeed, and also by other scholars. Allah is the One Whom we ask to keep the Muslims safe from all evils and to preserve their religious commitment and help them to understand their religion, and to keep them safe from everything that goes against His laws. May Allah send peace and blessings upon His slave and Messenger Muhammad and upon his family and companions.
See Majmoo’ Fatawa Samahat al-Shaykh Ibn Baz (may Allaah have mercy on him).