"Else what shall they do which are baptized for the dead, if the dead rise not at all? why are they then baptized for the dead?"
1 Corinthians 15:29
This is an interesting scripture. It seems like baptism for the dead was being practiced back in Christ's time. The point of it is to make sure that people that died without baptism get a chance to accept that ordinance, which is a requirement for salvation. It does seem like being baptized for the dead would be a bizarre practice if there were no afterlife... what would be the point? But God teaches us that there is an afterlife, and that some things are necessary. So, in that context, it is an incredibly merciful thing... part of God's plan to help as many of us make it back to him as possible. Requirements that people don't get a chance to take care of in their lives can be taken care of by others. Doesn't mean that we shouldn't get baptized when we have the chance though. Baptism opens the door to learning so much more, as well as showing our commitment to God when we've learned the truth. But it is awesome that God always has a plan for every exception. He doesn't let anyone fail the test due to technicalities. We all get to choose our eternities based on how we live this life.