Difference of religion (i.e. Islam as opposed to kufr) prevents a person from being a guardian (wali) for marriage purposes, according to the consensus of the scholars. A kaafir man cannot be the wali in the marriage of a Muslim woman, and a Muslim man cannot be the wali in the marriage of a kaafir woman, because Allah says (interpretation of the meaning): “And those who disbelieve are allies to one another…” [al-Anfaal 8:73] and: “Your Wali (protector or helper) is Allah, His Messenger, and the believers…” [al-Maa’idah 5:55]
The scholars made one exception, which is the case of a Muslim master acting in the marriage of a kaafir woman slave, but this is because it has to do with ownership, not guardianship. Similarly, the Muslim ruler or his deputy may play this role in the marriage of a kaafir woman who does not have her own wali for some reason.
In cases where people are of different religions and neither is Muslim, such as a Christian woman making a Jew her guardian, or vice versa, some scholars say that it is allowed, and some say that it is not allowed. The matter is similar to the case of a kaafir inheriting from a kaafir relative when they follow different religions, such as when one is a Jew and the other is a Christian. And Allah knows best.