A Muslim is not forced to follow one single madh-hab or scholar. It is valid to follow the opinion of any reliable scholar or school of Fiqh . We are not asked to stick only to the Hanafi school. All founders of the basic four sunni schools of Fiqh set such rules very clear. Imam Abu Hanifah, for example, is quoted to have said: “This is our opinion and we are ready to listen to him who brings a better opinion.” Imam Malik said: “Everyone’s opinion could be accepted or rejected except that of the one buried in this grave (pointing to the grave of the Prophet, peace and blessings be upon him). Ash-Shafi`i also said: “If a Hadith proves to be authentic (regarding a certain issue), then accept it and reject whatever religious opinion I may utter (regarding the same issue).

Therefore, we are allowed to pray behind a Shafi`i, Hanbali, or any followers of the correct schools of Fiqh. Deobandi follows the hanafi school of Fiqh, and therefore we may pray behind them.