This was on www.islamqa.com
Is every practitioner of magic or witchcraft a kaafir?
Praise be to Allaah.
The practitioner of magic is the person who uses the shayaateen (devils) and gets close to the jinn by doing the things they like – such as sacrificing to them instead of to Allaah, calling upon them alongside Allaah, obeying them by disobeying Allaah by committing zinaa, drinking wine, eating haraam things, neglecting prayer, covering himself with najaasaat (impure things) and staying in dirty places – until the shayaateen respond to what he asks them, with a gentle and kind approach, to do, such as harming the people against whom he uses his magic, causing division between a man and his wife, telling him some unseen things, and telling him about stolen items and where lost things are. Such a person is a mushrik and a kaafir, because he worships both Allaah and the Shaytaan, which is major shirk (al-shirk al-akbar). So he is a kaafir, because Allaah says (interpretation of the meaning);
“Sulaymaan did not disbelieve, but the Shayaateen (devils) disbelieved, teaching men magic” [al-Baqarah 2:102]
“but neither of these two (angels) taught anyone (such things) till they had said, ‘We are for trial, so disbelieve not (by learning this magic from us).’” [al-Baqarah 2:102]
It was also commanded that the practitioner of magic should be executed, because of the hadeeth: “The hadd (prescribed punishment) for the practitioner of magic is a blow with the sword (i.e., execution).”
(Narrated by al-Tirmidhi, 1460; al-Daaraqutni, 3/114; al-Haakim, 4/360; al-Bayhaqi, 8/136; see al-Silsilah al-Da’eefah, 3/641, no. 1446)
On this basis, he is a kaafir even if he prays, fasts, reads Qur’aan and makes du’aa’, because shirk cancels out all good deeds. And Allaah knows best.