Commentators have several possible explanations of 1 Corinthians 15:29. This is a difficult passage and we will probably have to settle for saying we are not absolutely certain what Paul is getting at. The question of interpretation depends on the question of whether there really were people being baptized for the dead in the church. This is debated.
Possibly some sort of "baptism for the dead" was practiced by another group. Possibly Paul is talking about something hypothetical. Possibly there were people actually doing this in Corinth. One thing we can be sure of, Paul is not promoting baptizing for the dead! My thought is that there was probably a fringe group somewhere which had proposed baptizing for the dead and that Paul was sarcastically referring to them in order to shame those in Corinth who were struggling with belief in the final resurrection of all souls at the end of time. Sometimes when we come across more difficult passages we ought to start by asking what it certainly does NOT mean. Once we eliminate the possibility that Paul is actually implying that baptism for the dead is an OK teaching, I think we can decide that it is not a devastating problem to be not exactly sure what Paul is referring to.
I am afraid that if you want "the" answer to this question, you will not find it, short of heaven. In other words, I do not believe one can create a convincing case for any one single interpretation, to the exclusion of all others, of why Paul uses this example. I think you can say what Paul is NOT saying. He is not saying that baptism of a living person in proxy for a dead person can lead to that dead person being saved. I am sure you do not need convincing from me on that point. A rule of hermeneutics is that one cannot interpret a difficult passage so that it contradicts a clear passage. It is clear from many scriptures that one cannot get another person into heaven by one's works without them repenting on their own. But what does it mean? Why did Paul use this example? You can look up a number of interpretations in any really good commentary on 1 Corinthians, but a couple are worth listing here.
- Perhaps Paul is sarcastically referring to a false doctrine that even some of them have considered in order to shame them in reference to the current question. It would be like, "You guys were willing to give consideration to baptism for the dead. Well, obviously you believed in the resurrection then. Why are you suddenly willing to abandon the idea now that it is a correct doctrine."
- Perhaps Paul is referring to an actual practice of another religious group. Some reject this possibility, but I do not.
The point of the passage is, essentially, "How could you guys actually be considering the possibility that there is no resurrection from the dead? I absolutely cannot believe we are struggling with this question! That is the most basic possible doctrine! Wake up guys! Without the resurrection, Christianity doesn?t even make sense!!!!" The exact interpretation of what Paul was referring to will have little if any effect on the main point he is making as described in the previous sentence. For that reason, to be honest, although I find the question a curiosity, I really do not think it is an especially important question to answer.