The idea comes from a variant of the quantum suicidethought experiment.
Suppose a physicist detonates a nuclear bomb next to himself.
In almost all parallel universes, the nuclear explosion would vaporize the physicist. However, there is a small set of alternate universes in which the physicist somehow survives. The idea behind quantum immortality is that the physicist would only be able to experience the universes in which he survives, even though they may be a small subset of the possible universes.
In this way, the physicist would appear from his own standpoint to be living forever. There are some parallels in this with the anthropic principle.

Many people regard this idea as nonsense, and argue that this outcome does not fall out naturally from the many worlds interpretation of quantum mechanics. They say that in the vast majority of universes, the physicist would cease to exist and therefore the most likely experience of a physicist standing next to a nuclear explosion would be the experience (or lack of experience) of ceasing to exist. The counterargument to this is that lack of experience is not itself an experience.

The critics argue that the continuity of consciousness, and the possibility of it enduring forever, are actually assumptions in this scenario, and ones with no physical basis. They also claim that the logic of the thought experiment would suggest that a conscious observer can never become unconscious, and therefore can never sleep. A counterargument to this is that there may indeed be parallel universes in which one never falls asleep; however, the subset of universes in which this happens is vanishingly small compared to the subset of universes in which one falls asleep and later wakes up again. Therefore, given the assumption that consciousness will continue, it is far more likely to continue into the latter set than into the former.

Proponents of the idea point out that while it is highly speculative, there is nothing in the notion of quantum immortality that violates the known laws of physics.

Although quantum immortality is motivated by the quantum suicide experiment, Max Tegmark, one of the inventors of the quantum suicide thought experiment has stated that he does not believe that quantum immortality is a consequence of his work. His argument is that under any sort of normal conditions, before someone completely ceases to exist they undergo a period of non-quantum decline (which can be anywhere from seconds to minutes to years), and hence there is no way of establishing a continuous existence from this world to an alternate one in which the person continues to exist. However, the idea of a "non-quantum decline" has no basis in any known laws of physics.