With a group of twelve human couples stranded on a island, how many generations could they go before becoming infertile due to inbreeding?
The big problem with inbreeding is the potential for genetic diseases to cause problems. This is usually related to the increased risk from a "bad" genetic variant which exists in a founding population. For example, suppose that a disease is tied to a single recessive allele (sickle cell anemia is, kind of, an example of this). A person who has one copy of the disease-causing allele (the "bad" variant) will be fine, while a person with two copies of the bad variant will be afflicted with the disease.
In a large population, it is likely that the prevalence of the bad variant of a gene will be relatively low (there is selective pressure which will, in general, select against the variant). As such, if two random people from a large population have children together, there is a relatively small chance of passing on a bad variant gene from both parents, and a correspondingly small chance that their children will be afflicted this recessive genetic ailment.
However (in this simplified model), any individual who has a copy of the disease-causing variant has a 50% chance of passing that variant on to their children. As such, if one sibling has the bad variant, then there is a 50/50 chance that the other will, as well. Hence there is a 25% chance that, if these siblings have children, those children will have two copies of the bad variant, and will be afflicted by this genetic disease.
Therefore having children with close relatives is risky because it increases the chance of passing on "bad" recessive genes.
However, if the founding population is free of these bad variants, or if there is significant genetic diversity in the founding population, then the chance any one individual having (and passing on) a dangerous recessive genetic ailment is relatively small. Hence population bottlenecks are not instant doom for a species (for example, it appears that every person in the Americas prior to European contact is descended from a population of around 70 people who crossed over Berengia around 15,000 years ago; 130 years ago, there were around [20 Northern elephant seals], the current population over 30k).
Thus, from a scientific standpoint, a small founder population could go on to establish a population which survives indefinitely.
As this is a question on Worldbuilding SE, rather than some other SE site, the actual question here is "In a fictional setting, how long could a population founded by a small group persist?"
The answer to that question is: it is up to the author.
If it is important for the plot that the colony is at risk of collapse due to a lack of genetic diversity, then the colony is at risk of collapse due to a lack of genetic diversity.
It is believed that every Cheetah alive today descends from a population bottleneck of at most seven individuals that lived roughly 10,000 years ago. This is far more extreme than a reduction to 12 couples, and did not result in infertility.
There are other problems that result from a lack of genetic diversity but there's no reason to believe that infertility would result.
Assuming Stable Genetics (Biiiiiig Assumption) and no pre-existing Genetic conditions and fixed environmental conditions - there's no reason why it couldn't go on forever.
The problem is that Genetics aren't completely stable and that the Environment is never fixed - You could look at some of the European Monarchies as case-studies in in-breeding and draw some conclusions from that.