The Sages assume that a husband and wife who have been married for ten years and have not had children will probably not have children together, so they declare that the husband must divorce his wife, pay her ketuba, and marry someone else in order to fulfill the mitzva. Even though divorce is terribly destructive – the Sages go so far as to say, “The altar sheds tears for someone who divorces his first wife” (Gittin 90b) – nevertheless the mitzva of procreation takes priority, for through it a person achieves continuity. Also, the short-term pain of divorce is generally less hurtful than the long-term pain of remaining childless.
True, when polygamy was practiced, the husband had the option of marrying a second wife without divorcing the first. This is what happened when Sarah was childless, as it says (Bereishit 16:3): “So Sarai, Avram’s wife, took her maid, Hagar the Egyptian – after Avram had dwelt in the land of Canaan ten years – and gave her to her husband Avram as a wife” (Yevamot 64a).
If a couple has one child, even if ten years pass and it is no longer possible that they will have an additional child and fulfill the Torah obligation of procreation, the husband is not obligated to divorce his wife. By having even one child, they fulfill the general mitzva for which the world was created (above, 5:3 and n. 2).
During the period in which a couple did not have children, if they were separated for an extended period of time or the husband or wife was sick, that time is not factored in the ten years. If the wife became pregnant but miscarried, the ten years are calculated from the time of the miscarriage (SA EH 154:10-12).
If a couple living outside of Eretz Yisrael moved to Eretz Yisrael, the ten years are counted from their arrival in Eretz Yisrael, because it is possible that in the merit of living in Eretz Yisrael they will conceive. Similarly, if a couple living in Eretz Yisrael left for a certain period of time, the time they spend abroad is not factored into the ten years (Rashi and Ramban on Bereishit 16:3; AHS 154:25).
If the husband believes that he is infertile, he is not obligated to divorce his wife. Nevertheless, if she wishes to get divorced in order to remarry and have children, he is obligated to grant her a divorce and pay her ketuba. However, if she wishes to stay with him, she may do so, since she does not have a personal obligation to procreate (Yevamot 64a; SA EH 154:6; above 5:3).
It is important to emphasize that the obligation of a husband to divorce his wife after ten years does not establish that she is infertile, but simply means the chances of their conceiving a child together are slim. It is certainly possible that she will be able to have children with a different husband. Therefore, a man who has not yet had children may marry her. If after ten years she has not conceived with her new husband, he too must divorce her. After that, a man who has not yet fulfilled the mitzva of procreation may not marry her. Since she has failed to conceive with two different men, it is likely that that she is infertile (Yevamot 64a; SA EH 154:16-17).
Everything we have said about a man being obligated to divorce his wife after ten years applies to a situation in which there is no clear medical diagnosis. However, if reliable doctors have concluded that there is no chance that the wife will conceive, then even though the couple has not yet been married for ten years, her husband may divorce her in order to fulfill the mitzva to procreate; and vice versa, if ten years have passed but reliable doctors believe that there is still a reasonable chance that the wife will conceive, her husband is not required to divorce her (see Responsa Maharashdam YD §91; Meshiv Davar 4:9; Ish U-veito 16:15, end of n. 1.)