1 Corinthians 15:29 (EHV) Otherwise, what will those people do who get baptized for the dead? If the dead are not raised at all, why do they even get baptized for them?
My understanding is that there were martyrs who died before baptism but desired baptism. In honor of them, one would be baptized in their honor.