Thomas Scott compiled one of the best answers to this question:
The expression, “baptized for the dead,” has given occasion to a variety of ingenious conjectures and learned discussions. Some argue that [1] only means, “baptized in the name of one who certainly died, and who, “if the dead rise not, still remains among the dead.” But the word rendered “dead” is plural, and all the labour bestowed to remove that difficulty is to no purpose. Others suppose that the apostle refers to a practice, which it seems, at one time prevailed in the church, of baptizing a living person in the stead, and for the supposed benefit, of one who had died unbaptized. But who can imagine, that so absurd and gross a superstition was customary, when the apostle wrote? Or that if it were, he should sanction it?
Beza — Rather triumphantly, concludes that he has discovered and fixed the true interpretation; and that the apostle meant the washing of the dead bodies, among the Jews and Christians, before burial (Acts 9:37), which he thinks was a profession that they expected a resurrection. But the use of the word “baptize,” in such a connection, could hardly be expected; and the words will not bear that sense, by any fair interpretation.
Hammond — contends that it means the profession of faith, concerning the resurrection of the dead, which was required of persons at their baptism, which represented, as he thinks, the burial and resurrection of Christ. “Why did they profess this, if they did not believe it?” But this is far from satisfactory: for the peculiar circumstances of some persons, when they were baptized, seem evidently intended. “What this baptizing for the dead was, I confess I know not; but it seems by the following verses, to be something, wherein they exposed themselves to the danger of death.”
Locke — The following interpretation, however, suggested by Dr. Doddridge, who received it from Sir Richard Ellis, appears the true one. The apostle refers to the case of those, who presented themselves for baptism, immediately after the martyrdom of their brethren, or at their funerals; as if fresh soldiers should enlist and press forward to the assault, to supply the places of those who had fallen in battle. Thus they professed their faith in Christ, and ventured the rage of their enemies, at the very time when others had been put to death for the gospel. But what advantage could they propose to themselves from such a conduct, if there were no resurrection?
Or what wisdom could there be in so doing? For in this case, Christianity itself would lose the great evidence of its truth; even the immortality of the soul might be called in question; believers were yet “in their sins;” and they who died as martyrs had lost their souls, as well as their lives. This might show the Corinthian speculators how greatly their notions tended to discourage men from professing the gospel in times of persecution, and to make them afraid and ashamed to own the cause of Christ. If this were the case, why did Christians in general, or the apostles and evangelists in particular, live in continual and imminent danger of suffering and death, by their open profession of the gospel, and their zeal in promoting it? They could have no sufficient encouragement for so doing, if the dead should never arise.
Endnotes Thomas Scott, The Holy Bible with Explanatory Notes, Practical Observations, and Copious Marginal References, Vol. 3 [New Testament], New York: Collins & Hannay, 1832, pp. 601-602. Paragraph divisions added.