The “no” answers I see are making several incorrect assumptions: (1) that after a number of generations, inbreeding would surface some deletarious mutation and kill off all future offspring, (2) that two random humans wouldn’t have sufficient genetic variance between them, and (3) that endangered humans would react the same way as other endangered mammals. Additionally, the answer asks whether repopulation is possible, not whether it’s likely or not.
To address these:
(1) During the first generation (the initial two humans), even a serious and lethal mutation (such as ) would be passed to 50% of offspring, and those who had it would still have a good chance of living years into adulthood (and being able to reproduce). A much larger risk than a lack of genetic diversity would be the death of the mother from childbirth.
(2) This leads to the issue of genetic variance. The truth is that some degree of inbreeding is relatively common, and rarely very harmful – displayed in humans means that we seek out mates genetically similar to ourselves. Yes, they would probably experience over time, but this is something that many isolated, rural populations have experienced, and haven’t been doomed by it. Even if it caused lower chances of survival, this wouldn’t mean that some generation would be the cut-off for survivability. Humans would lose a huge amount of genetic diversity, but diversity would slowly begin to improve over time from random mutation, which would help to weed out deleterious genes via natural selection.
(3) Endangered animals don’t understand that they’re endangered, so using them as case studies is not a good comparison. They obviously wouldn’t change their behavior in any way to compensate for their endangered status. Humans who were aware of the fact that they were the last ones left would be intelligent enough to reproduce as much as possible.
In our theoretical world of best possible circumstances, an particularly virulent pandemic occurs on earth, wiping out all humans on the planet. Two astronauts (one male, one female) return to earth after several months in space, only to discover that no other humans are alive.
Fortunately, they can scavenge canned food for years and have readily available housing. Thanks to having a library in their town with printed books, they are able to teach themselves basic medical care and farming, and eventually become self-sustainable. Additionally, since human-specific viruses can only survive hours without a living host, most viral disease threats have been suddenly eliminated. The two humans realize that they need to continue the human race, so they decide to have as many children as possible to maintain the diversity that they both offer. They have nine children before infertility sets in. The early generations face many challenges, including comparatively high early mortality rates, but are able to thrive in spite of set-backs thanks to their adaptive intelligence. It takes tens of thousands of years, but over time the gene pool diversifies, and humans spread to populate new towns, eventually migrating to other continents as well.
Therefore, the answer is “yes” – it’s possible that two humans could survive and repopulate the earth.