Praise be to Allah.
You should note, first of all, that the fuqaha’ are unanimously agreed that it is not permissible for a Muslim to be buried in the kaafir graveyard, or for a kaafir to be buried in the Muslim graveyard, except in cases of necessity. See al-Mawsoo’ah al-Fiqhiyyah,21/20; Ahkaam al-Maqaabir fi’l-Sharee’ah al-Islamiyyah by Dr. ‘Abd-Allaah al-Suhaybaani, p. 231-232.
If a Muslim dies in a kaafir land, then his heirs, or whoever among the Muslims knows of him, must take him to a Muslim land so that he may be buried there.
Taking him to a Muslim land depends on being able to do it. If it cannot be done, then he may be buried in the kaafir land, but not in their graveyards. See: Ahkaam al-Maqaabir, p. 225-226.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: This is more important than being distinguished from them in life, by wearing different clothes etc, because there is mercy in the graveyards of the Muslims, but there is punishment in the graveyards of the kaafirs. Al-Ikhtiyaaraat, p. 94.
The situation that you asked about is one that happens frequently for many Muslims in positions of weakness in kaafir countries, because they are not able to migrate to a land where they can practise their Islam openly and be safe, nor can they practise Islam openly in the lands where they live, either for fear of aggression from their own relatives, as is the case in your question, or for other reasons. These people will be resurrected according to their intentions, and the ruling in the Hereafter will depend on what they have of faith and righteous deeds, not the ruling on the land in which they died or the grave in which they were buried. It was narrated that Jaabir ibn ‘Abd-Allaah said: I heard the Prophet (peace and blessings of Allaah be upon him) say: “Each person will be resurrected according to the state in which he died.” Narrated by Muslim (2878).
It was narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) offered the funeral prayer and said: “O Allaah, forgive our living and our dead, our young and our old, our males and our females, those who are present and those who are absent. O Allaah, whomever among us You cause to live, cause him to live in faith, and whomever among us you cause to die, cause him to die in Islam. O Allaah, do not deprive us of his reward and do not let us go astray after him.” Narrated by Abu Dawood (3201); classed as saheeh by al-Albaani in Saheeh Abi Dawood.
Shaykh Muhammad al-Saalih al-‘Uthaymeen (may Allaah have mercy on him) said:
“O Allaah, whomever among us you cause to live, cause him to live in faith, and whomever among us you cause to die, cause him to die in Islam” – with regard to life he mentioned Islam, meaning outward submission, and with regard to death he mentioned faith, because faith (eemaan) is better, and its seat is the heart, and what matters at the time of death and on the Day of Resurrection is what is in the heart.
Sharh Riyadh al-Saaliheen (2/1200)
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) was asked about what some people say, that Allaah has angels who move people from the Muslim graveyards to the Christian and Jewish graveyards, and from the Jewish and Christian graveyards to the Muslim graveyards, and their purpose is that whoever met a bad end in the sight of Allaah, although he was outwardly Muslim when he died, or he was a kitaabi (a Jew or Christian) but he met a good end and died as a Muslim in the sight of Allaah, although he appeared to be a kaafir when he died, so these angels move them. Has any report been narrated concerning this or not? Is there any proof for this or not?
He (may Allaah have mercy on him) said: As for the bodies, they are not moved from the graves but we know that some people who are outwardly Muslims are in fact hypocrites, either Jews, Christians or apostates. Whoever is like that will be with his peers on the Day of Resurrection, because Allaah says (interpretation of the meaning): “Assemble those who did wrong, together with their companions” [al-Saaffaat 37:22], i.e., those who were like them and their peers.
And there may be some who died appearing to be kaafirs, but they believed in Allaah before the death rattle reached their throats, but there were no believers with them and they concealed that from their families, either because of inheritance or some other reason. But they will be with the believers even if they are buried with the kuffaar.
As for the report about the angels moving them, I have never heard any report about that. End quote from al-Fataawa al-Kubra (3/27).
And Allaah knows best.