For the source text click/tap here: Yevamot 64
To download, click/tap here: PDF
If a man was married to a woman for ten years, and they did not have any children, in the times of the Talmud he would have to divorce her or marry another wife, so that he can fulfill the mitzvah of procreation.
This is only true if he did not children before. It also assumes that they don't know who is at fault. However, if the man is sterile, there is no point for him to divorce her, since he cannot have children with anybody else anyway.
After he divorces her, she has no presumption of not being able to have children, and when she marries to another man, the new husband needs to also count ten years before applying the rule above.
We explore the whole notion of the barren wife and her treatment.