God loves the sick. When someone is very sick or very old and could die soon, they need God’s help for that moment. Anointing by a priest helps bring strength, peace and encouragement. Part of this sacrament is forgiving all the sins of the sick person and preparing him or her for their time of death.
The sick, with their pain and suffering, help Jesus to carry the Cross, and at the same time, He helps them during the last moments of their lives.
Anyone who is baptized and of the age where he can go to confession
It's not necessary to wait until someone is dying to receive the Sacrament. Instead, a thoughtful assessment of the severity of the illness is all that's needed. It's common to receive Anointing of the Sick before a surgery.