The Divine Master admonishes us in the Gospel to prepare ourselves well for death… His love for us makes Him desire ardently that we should leave this world entirely purified… It is for this end that He ordinarily sends us the pains of sickness before death, and that He has instituted the Sacraments, to aid us in sanctifying our sufferings, and the more perfectly to dispose us to appear before His face.
The Sacraments which we receive in time of sickness are three: Confession, which we may receive as soon as we wish; Holy Viaticum and Extreme Unction, which may receive as soon as there is danger of death.
It is not necessary that there should be an imminent danger of dying, and that all hope of recovery be lost… it suffices that it be probable, and prudently presumed, even when there is no other infirmity than old age.
These divine remedies purify the soul from her sins, and increase her treasure of sanctifying grace; they fortify the sick person, and enable him to bear his sufferings with patience, to triumph over the assaults of the demon at the last moment, and to make a generous sacrifice of his life to God.
[T]he first care of a Christian, in case of sickness, must be to think of the Sacraments, and to receive them as promptly as possible.
—from Purgatory: Explained by the Lives and Legends of the Saints by Fr. F.X. Schouppe, S.J., Part Second: Purgatory, The Mystery of God’s Mercy – Ch. 63