There is a difference of opinion among Muslim jurists concerning offering funeral prayer for martyrs. Imam Abu Hanifah stated that it is obligatory to offer Funeral Prayer for the martyrs. However imam Malik, Ash-Shafi`i, and Ahmad, in one of two statements, opine that it is preferable not to offer Funeral Prayer for the martyr.
we would like to cite for you the following Fatwa issued by Sheikh `Atiyyah Saqr, former Head of Al-Azhar Fatwa Committee, in which he states the following: A martyr is the one who is killed in a battle between Muslims and disbelievers. Some authentic Hadiths state that no janazah (Funeral Prayer) should be offered for a martyr. For example, Al-Bukhari has narrated on the authority of Jabir (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) ordered that the martyrs of the battle of Uhud be buried while they were still bleeding without washing them or offering janazah for them.

However, there are some other authentic Hadiths that explicitly state that a Funeral Prayer should be offered for them. Al-Bukhari has narrated that one day the Prophet (peace and blessings be upon him) went out and offered janazah for the martyrs of Uhud, eight years after their death, as if he were bidding farewell to both the living and the dead. But this Hadith is irrelevant to the issue, as the difference is over the prayer before burial.
In a Mursal Hadith (A report of the Successor directly from the Prophet without any other Companion in between) Al-Bayhaqi quotes Abu Malik Al-Ghifari as saying: “The bodies of the martyrs of Uhud were brought in nine patches of cloth and placed with the body of Hamzah, who completed the ten. The Prophet (peace and blessings be upon him) offered prayer for them, then the nine bodies were carried (to be buried) leaving the body of Hamzah undisturbed. Then another nine martyrs were brought and placed beside Hamzah. The Prophet (peace and blessings be upon him) offered janzah for them as well. This way the Prophet (peace and blessings be upon him), offered Funeral Prayer for all of them.”
However, the Hadith narrated by Jabir is more authentic than the one narrated by Abu Malik Al-Ghifari. Ibn Hazm is of the opinion that it is both permissib
le to offer or not to offer janazah for the martyrs. He says: “It is alright whether or not janazah is offered for the martyr.” Ahmad ibn Hanbal has also expressed a similar view in one of his statements. Ibn Al-Qayyim approves of this view, saying: “What is apparent from this is that no Funeral Prayer was offered for the martyrs of Uhud before burying them. There were seventy persons who died martyrs in that battle, and any Funeral Prayer for them could not have taken place in secret.”
The Hadith reported by Jabir that (the Prophet) did not offer prayer for these martyrs is authentic, as his father `Abdullah was among those were killed that day, and thus he knew better than others did.
Abu Hanifah is of the view that it is wajib or obligatory to offer Funeral Prayer for the martyrs. However Malik, Ash-Shafi`i, and Ahmad, in one of two statements, opine that it is preferable not to offer Funeral Prayer for the martyr.
Thus, offering Funeral Prayer for the martyr is not obligatory; rather, it is permissible as no explicit Hadith has been narrated to support the prohibition, not to mention the Hadith reported by Al-Bayhaqi (which states it is permissible).
This applies to martyr who is killed in a battle between Muslims and disbelievers. As for other kinds of martyrs, such as the one who dies of a gastric aliment and other types who have been mentioned in many Hadiths, they should be washed and offered a Funeral Prayer.
As for offering the janazah for the dead who are not present, it is permissible. Thus, it is permissible (for non-Palestinians) to offer janazah for those who died martyrs in Palestine. Since no text has been narrated to prohibit it. Still, it is not obligatory to do so.