The baptism would not be valid.
Also the priest would be reprimanded if it was discovered.
Canon law lays down the conditions for adult baptism.
Can. 865 §1. For an adult to be baptized, the person must have manifested the intention to receive baptism, have been instructed sufficiently about the truths of the faith and Christian obligations, and have been tested in the Christian life through the catechumenate. The adult is also to be urged to have sorrow for personal sins.
§2. An adult in danger of death can be baptized if, having some
knowledge of the principal truths of the faith, the person has
manifested in any way at all the intention to receive baptism and
promises to observe the commandments of the Christian religion.
Also, thanks to Ken Graham:
Baptism can not be forced on someone. One must not baptize a person
who has lost his or her mind, if this person didn't show their
intention to be baptized while they were still mentally competent.
[Summa Theologica, III, q. 68. a. 7, a. 10, a. 12].