Praise be to Allah.
Bid’ah (innovation) may amount to kufr, as in the case of the Jahamis, Raafidis and those who believe in hulool (incarnation) and ittihad (unity of the Creator and creation), in which case their prayer is not valid and it is not permissible for anyone to pray behind them;
Or the bid’ah may not amount to kufr, such as speaking the intention (niyyah) out loud, and gathering to recite dhikr together as the Sufis do. The prayer of these people is valid, as are prayers offered behind them. But the Muslim has to advise them to give up this bid’ah. If they pay heed, then this is what is wanted, otherwise the person has done what he was obliged to do. In this case it is better to look for another imam who is keen to follow the Sunnah.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him0 said:
The kind of bid’ah for which a person is regarded as being one of those who follow their whims and desires is that which is well known among the scholars of the Sunnah for going against the Qur’aan and Sunnah, such as the bid’ah of the Khaarijis, the Raafidis, the Qadaris and the Murji’is. ‘Abd-Allaah ibn al-Mubaarak, Yoosuf ibn Asbaat and others said: The roots of the seventy-two sects are four: the Khaarijis, the Raafidis, the Qadaris and the Murji’is. It was said to Ibn al-Mubaarak, And the Jahamis? He said, The Jahamis are not part of the ummah of Muhammad (peace and blessings of Allaah be upon him).
The Jahamis deny the divine attributes and say that the Qur’aan was created, that Allaah will not be seen in the Hereafter, that Muhammad was not taken up to Allaah [on the night of the Mi’raaj], and that Allaah has no knowledge, power or life, and so on, as the Mu’tazilis, philosophers and their followers said. ‘Abd al-Rahmaan ibn Mahdi said: There are only two groups to beware of: the Jahamis and the Raafidis.
These two groups are the worst of the followers of innovation, and from them stemmed the esoteric Qaraamiti groups such as the Nusayris and Ismaa’ilis. Similar to them are those who believe in the unity of the Creator and the creation, because their ideas are akin to Pharaonic ideas.
The Raafidis of the current age, as well as being Raafidis are also Jahamis and Qadaris, because in addition to their rafd [which has to do with their beliefs concerning the imams] they also follow the Mu’tazili school of thought, and some of them even follow the school of thought of the Ismaa’ilis and other similar heretics and those who believe in the unity of the Creator and the creation. And Allaah and His Messenger know best.
Majmoo’ al-Fataawa, 35/414-415.
The Scholars of the Standing Committee said:
With regard to praying behind an innovator, if his bid’ah amounts to shirk, such as calling upon someone other than Allaah, making vows to someone other than Allaah, or believing that their shaykhs possess attributes that belong to Allaah alone – such as perfect knowledge, knowledge of the unseen or the power to influence events – then prayers offered behind them are not valid. If their bid’ah does not amount to shirk, such as reciting dhikrs that were narrated from the Prophet (peace and blessings of Allaah be upon him), but doing that in unison and swaying from side to side, then prayers offered behind them are valid, but the Muslim should look for an imam to pray behind who is not a follower of innovation, because that will increase his reward and is farther removed from evil.
And Allaah is the Source of strength. May Allaah send blessings and peace upon our Prophet Muhammad and his family and companions.
Fataawa al-Lajnah al-Daa’imah, 7/353
And Allaah knows best.