The Code of Canon Law has in canon 1007: “The annointing of the sick is not to be conferred upon those who obstinately persist in a manifestly grave sin.”
(The Code of Canon Law: New revised English Translation, HarperCollins Liturgical, 1997, ISBN 000599375X.)
So there could be situations where refusal of the sacrament of confession could be understood as “obstinately persist in a manifestly grave sin.” The priest would need to be aware of the sin and that the person did not go to confession.
But generally the Sacrament of the Annointing of the Sick can be given to someone without confession. The person may know that are in a state of mortal sin, the priest may not have the faculty to hear confessions, but could give them the annointing of the sick.
It is optional to receive Communion as part of the annointing of the sick.