Is the story of the good thief in Luke 23:39–43 proof that baptism isn’t necessary?
First, it isn’t clear that baptism had yet been mandated by Jesus before he met the thief. If it had been, we do not know for certain that the thief hadn’t already been baptized. In any case, the thief clearly underwent a conversion at some point during his crucifixion, and it seems evident that he would have desired baptism before his death had he known of its necessity. That would have been sufficient, because the Church recognizes that, in such a case, the desire for baptism brings about the fruits of baptism (CCC 1258).