Many Catholic theologians are of the very commonly held opinion that there is a so-called 'baptism of desire' whereby the grace of the Sacrament of Baptism ('baptism of desire' is not, however, an alternative to water baptism, which is the exclusive form of the Sacrament, but more of an action of God, not man, whereby he fulfills all anyone else is required to, and so recieves the same grace) is applied to that person if they are prevented by something which doesn't rely on them, such as someone collapsing before they are able to baptize them, and they die, for an extreme example. Some argue for the rather indefensible idea that God 'wouldn't' let someone die before recieving such a Sacrament. I don't think there is any revelation which tells us whether this is the case or not, and is an assumption. On the other hand, it's not impossible to see how not being able ot recieve the Sacrament is a punishment from God, or even a mercy. There is a greater punishment for those who have come to grace and turned, than for those who haven't tasted of it or partaken of it. Baptism leaves an indelible mark on the soul: 'Bought By Christ.'
It should be noted that whereas Baptism is necessary for a person to be saved (John 3:5), Extreme Unction (a.k.a the Anointing of the Sick) is not, but rather an extremely great help, when made use of (as the Apostle James recommends: James 5:14-15). The Sacrament of the Anointing of the Sick gives the person more strength not to sin until their death, sometime even the grace to recover from the brink of death, but also remits all temporal punishment due to their sins already forgiven (i.e. they will not need to go through Purgatory before they are able to enter Heaven). It's a very powerful Sacrament, and is much like Baptism.
This is certainly a defensible view (baptism of desire) given the Decree on Justification from the Council of Trent (Session VI, Decree on Justification, Chapter IV):
..[justification is] a translation, from that state wherein man is born a child of the first Adam, to the state of grace, and of the adoption of the sons of God, through the second Adam, Jesus Christ, our Saviour. And this translation, since the promulgation of the Gospel, cannot be effected, without the laver of regeneration, or the desire thereof, as it is written; unless a man be born again of water and the Holy Ghost, he cannot enter into the Kingdom of God.
This certainly suggests a certain allowance for those who, because they have the desire, will recieve the grace: other things not in their power preventing them from having it adminstered in the normative way not withstanding, else I think the qualification would be redundant.
This is only a theological theory, not official or dogmatic teaching. But it's nonethless in line with Catholic dogma. And again, it's by no means to be relied upon as a given, but rather a hopeful expectation.
An analogy might be that Abraham was considered just because he would sacrifice his own son for the sake of God. But yet if he was killed before he got to the top of the mountain, (not in his power to change, and thus impossible for him to be culpable for it) would his meritorious good intention decrease? No, God justified Abraham the moment he pledged in his heart to do what God commanded him.
This has been about baptism, but it applies to the Sacrament of Confession and the Anointing of the Sick equally in this case, because these serve the dying person as Baptism serves the unjustified person: to restore them to the justified state, the state of grace.
In any case, God is not bound by the Sacraments—we are. We should view them in this light always. It's not given to us to surmise what God 'would' or 'might' do, but always hope, always trust and never question the motives or justice of God. And everyone wins. A great way to do this is to remember that it is impossible for a man to be more just than God, so that all theological discussion which implicitly fears that maybe God needs our help to remember the poor souls who die in this state or in that way, is a wasted discussion. God knows literally the best possible way to deal with them, and has dealt with them in that way.