Praise be to Allah, and may Allah’s peace and blessings be upon the Messenger of Allah, his family and his companions.
Wa alaikum assalam wa rahmatullahi wa barakatuh.
As to what follows:
The commandment for a person to pray a farewell prayer is mentioned in many narrations on the Prophet (peace be on him), by looking at its chain of narrators it appears nothing short of being weak, except that there is an indication that it has an origin. From these narrations is a hadith that has been narrated be Ahmad(22987), Ibn Majah (4171) on the authority of Abu Ayub al-Ansari (may Allah be pleased with him) that:
“A man came to the Prophet (peace be on him) and said: ‘O Messenger of Allah, teach me but make it concise.’ He said: ‘When you stand to pray, pray like a man bidding farewell. Do not say anything for which you will have to apologize. And give up hope for what other people have.”
A similar hadith recorded by Al-Tabrani in al-Awsat (4427) has been narrated by Ibn Umar (may Allah be pleased with him) and other sahabahs.
However, there is nothing in these narrations that proves that The Messenger of Allah (peace be on him) used to say it when straightening rows, what is apparent is that there is no harm if an Imam say it, especially if he finds it necessary to say it like in case of disturbances or busyness that may prevent attentiveness.
And Allah knows best.
Dr. Khalid al-Muslih
4 / 1 / 1429 AH