When a person is in the last stage of life, and they are about to enter the life of eternity, those who are with them should make du’a. This is because the angels of death are waiting nearby to take the soul of the person, and they say Amin to every du’a made on that frightening occasion.
Umm Salamah narrated that the Prophet, peace be upon him, entered upon Abu Salamah (while he was on his death bed), and his eyes had fixed into a stare (i.e. he had died), so the Prophet, peace be upon him, closed his eyelids and said:
“When the soul leaves the body the eyes follow it.”
At this the people of Abu Salamah’s house began crying, and the Prophet, peace be upon him, further said:
“Do not ask for yourselves anything but good, for the angels will say Amin to all that you ask for. O Allah, forgive Abu Salamah, and raise his ranks among those who are guided…” (Recorded in Muslim)
Therefore, if we are ever in the presence of one who is about to die, we should pray for all that is good, for the dying person and for their family, and for ourselves.