Should We Offer The Funeral Prayer for Martyrs?
Question

Should the funeral prayer be offered for Muslims who are slain in battles against the disbelievers?.
Praise be to Allah.Ruling on Offering Janazah Prayer for Martyrs
The martyr is a Muslim who dies fighting the disbelievers and for that reason. (Al-Mawsu`ah Al-Fiqhiyyah, Kuwait edition, 26/272)
The majority of scholars said that the funeral prayer should not be offered for him. That is the view of Imam Malik and Ash-Shafi`i, and the more correct of the two views narrated from Imam Ahmad. (Al-Mughni, 2/334)
Purpose of Funeral Prayers
That is because the Prophet (peace and blessings of Allah be upon him) did not pray for the martyrs of Uhud (Narrated by Al-Bukhari, 1347), and because the purpose behind the funeral prayer is to intercede for the deceased. But the martyr receives expiation for everything (so he has no need of intercession), apart from debt; debt is not waived because of martyrdom, rather it remains owed by the deceased.
Shaykh `Abd Al-`Aziz ibn Baz (may Allah have mercy on him) said:
It is not prescribed to offer the funeral prayer for the martyrs who die in battles, or to wash them, because the Prophet (peace and blessings of Allah be upon him) did not offer the funeral prayer for the martyrs of Uhud, neither did he wash them. This was narrated by Al-Bukhari (1347) from Jabir ibn `Abdullah (may Allah be pleased with him). (End quote from Majmu` Fatawa Ibn Baz, 13/162)
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
No one among the people – neither the Imam nor anyone else – should offer the funeral prayer for the martyr, because the Prophet (peace and blessings of Allah be upon him) did not offer the funeral prayer for the martyrs of Uhud, and because the purpose behind the funeral prayer is to intercede for the deceased. The Prophet (peace and blessings of Allah be upon him) said: “There is no Muslim man who dies, and forty men who do not associate anything in worship with Allah offer the funeral prayer for him, but their intercession with Allah for him will be accepted.” But the martyr receives expiation for everything apart from debt, because debt cannot be waived by martyrdom, rather it remains owed by the deceased and is to be paid off from his estate if he left anything behind. Otherwise if he took it with the intention of paying it back, Allah will pay it back on his behalf. (End quote from Ash-Sharh Al-Mumti`, 5/367)
The Case for Optional Janazah Prayers for Martyrs
Some of the scholars were of the view that it is permissible to offer the funeral prayer for the martyrs – but it is not obligatory. This was narrated from Imam Ahmad (Al-Mughni, 2/334). That is because of the following Hadiths:

It was narrated from Shaddad ibn Al-Had (may Allah be pleased with him) that a man from among the Bedouin came to the Prophet (peace and blessings of Allah be upon him) and believed in him and followed him, then he said: “I will migrate with you.” They stayed there for a while, then they engaged in fighting the enemy. He was brought to the Prophet (peace and blessings of Allah be upon him), and he had been struck by an arrow… Then the Prophet (peace and blessings of Allah be upon him) shrouded him in his cloak, then he placed him in front of him and offered the funeral prayer for him. (Narrated by An-Nasa’i; classed as authentic by Al-Albani in Ahkam Al-Jana’iz, p. 82)
It was narrated from `Abdullah ibn Az-Zubayr (may Allah be pleased with him) that on the day of Uhud, the Messenger of Allah (peace and blessings of Allah be upon him) ordered that Hamzah be wrapped in his cloak, then he offered the funeral prayer for him. He said Takbir nine times, then the slain were brought and laid in rows, and he offered the funeral prayer for them and for him with them. (Narrated by At-Tahawi in Ma`ani Al-Athar, 1/290; classed as sound by Al-Albani in Ahkam Al-Jana’iz, p. 82)

Among those who favoured this view was Shaykh Nasir Ad-Din Al-Albani (may Allah have mercy on him). (Ahkam Al-Jana’iz, p. 81)
For more details, please see the following answers: 72303, 11419, 13762.
And Allah knows best.