All jurists with the exception of Abu Hanifah are in agreement that the two salutations (saying assalamu ‘alaikum wa rahmatullah), one to the right and the other to the left, are obligatory. Abu Hanifah, however is of the view that they are required, but not obligatory as a condition. Those who hold it to be obligatory argue that the funeral prayer is a prayer (salah), and as such it cannot be terminated except by salutations (to the right and left).
Ibn Mas’ud said: “Salutations at the end of a funeral prayer are similar to those said at the end of any formal prayer. The minimum that would suffice in this respect is to say: “As-Salamu ‘Alaikum” or “salamun ‘alaikum” (the peace be with you or peace be with you).”
Ahmad is of the opinion that one salutation – the salutation to the right – is sunnah, and there is no harm if one says it while looking straight ahead. This is based on the practice of the Prophet, peace be upon him, and his Companions who ended their funeral prayer with one salutation. No difference of opinion among them is on record on this issue.
Ash-Shafi’i holds that two salutations, turning one’s face first to the right and then to the left, are commendable. Ibn Hazm said: “The second salutation is remembrance of Allah, and an act of virtue.”