The funeral prayer was offered for the deceased once in America and again when he was brought to Pakistan
Praise be to Allaah.
It is correct to offer the Janaazah prayer for the deceased more than once. Both prayers are valid and it is hoped that the prayers will be an intercession for the deceased. Ibn Qudaamah said: “If a person catches up with the janaazah (funeral) but did not offer the prayer, he can still pray (Salaat al-Janaazah) for the deceased. This was done by ‘Ali and Anas, may Allaah be pleased with them, and by Sulaymaan ibn Rabee’ah, Abu Hamzah and Mu’ammar ibn Sameer. The prayer may be offered at the graveside, and it may be repeated before the burial either in congregation or individually. This was stated by Ahmad, who said: “There is nothing wrong with that. It was done by a number of the Companions of the Messenger of Allaah (peace and blessings of Allaah be upon him).”(al-Mughni, 2/512)
In a hadeeth, Ibn ‘Abbaas said: “The Prophet (peace and blessings of Allaah be upon him) reached a new grave, and they formed a row behind him, and he recited Takbeer (said “Allaahu akbar”) four times.”(Agreed upon. Al-Bukhaari, 1319, Muslim, 1586).
Al-Sheeraazi said: “If someone comes who has not yet offered the (funeral) prayer for him, he should do so.”(al-Muhadhdhab , 1/134).
Both the prayers are valid, because the prayer for the deceased may be offered more than once for a valid reason. Some of the scholars mentioned that it is permissible for a person who missed the funeral prayer to offer the prayer over him in his grave, up to a period of one month following his death. So those who offered the prayer for him in Pakistan did so because they had not prayed for him before that.
We must also point out that the Sunnah is to bury the deceased where he died, except in cases of necessity. So if there is a Muslim graveyard in the place where a person dies, he should be buried there. And Allaah knows best.