Perhaps he had been baptized. Perhaps John Baptist had baptized him, and perhaps he had stood in the water with John and confessed the sin and offense against the law for which he was later condemned and crucified.
Or, perhaps the man had not actually committed any offense other than one of a political nature against the Roman Empire. I say this with full realization that the Scripture does label him a "malefactor." We do not know the nature of the offense, or against whom, that put him on a cross.
What we do know is that he recognized the King-ship of Christ and that Christ would come in a Kingdom. He had prior knowledge of what Messiahship meant, and just Who was the Messiah.
We know that the man was not baptized in water between his dying confession of Christ and his bodily death. The Bible does not tell us whether he had ever been baptized in water.
Luke 23:34 - Then said Jesus, Father, forgive them; for they know not what they do. And they parted his raiment, and cast lots.
Jesus even asked for the forgiveness of those that crucified him. Thankfully, we have a forgiving Lord.