Fr Mullady talks about this in connection with giving the last rites here:
Last Rites for the Clinically Dead?
Question: Is it possible to perform the sacrament of the sick on someone who has been pronounced clinically dead? If so, up to how long after clinical death can this sacrament be performed?
Answer: This issue is central to the pastoral care of the dying. Priests are often faced with a dilemma when they are called to spiritually assist those near death and discover on their arrival that the person has died. Traffic accidents lead to sudden death or the priest is too far away to arrive before someone has died and the issue of anointing is raised. What does one do in the circumstances?
This question may seem straightforward. A priest cannot give a sacrament to a dead person nor can a dead person receive a sacrament. So it would seem that one should just not anoint. But this is too rigorist and does not really correspond to the whole philosophical discussion involved in the question of death. The Church defines death as the condition in which the soul has left the body. Yet, the actual moment in which the soul leaves the body has never been defined by the Church and remains unclear. Clinical death is not metaphysical death. There is a process which occurs in death which may be only a few minutes to a few hours. The sacraments are only for the living. So there may be a time between clinical and metaphysical death when one could confer the Sacrament of Anointing without exposing the sacraments to ridicule.
Anointing, then, can be a special case. In the absence of the confession of sins, it can also forgive sins for those unable to confess. Hence its connection to the dying. This sacrament is defined in canon law as to whom it should be given: “The anointing of the sick can be administered to a member of the faithful who, having reached the use of reason, begins to be in danger due to sickness or old age” (c.1004, n1). The
Catechism further clarifies:
The anointing of the sick is not a sacrament for those only who are at the point of death. Hence, as soon as anyone of the faithful begins to be in danger of death from sickness or old age, the fitting time for him to receive this sacrament has certainly already arrived.(1514)
The reason this question is not so straightforward is the contemporary debate over when death occurs, which includes issues which are
ad rem to problems in medicine of euthanasia, organ harvesting, and issues such as these. In the past, of course, the anointing was basically done only at the moment of death. It was known as Extreme Unction and, although there is still an aspect of the sacrament where it may be used to strengthen the person to face death, its primary purpose is to give spiritual strength during any serious illness. The most important preparation for death would be recourse to the Sacrament of Penance and the reception of communion. All the same, if one cannot or has not confessed, the presumption is in favor of repentance and this sacrament has an aspect of the forgiveness of sin.
continued….