Yevamos, chapter six, mishnah 6. The mishnah opens: "Lo yevatel adam mi'periyah u'reviyah ela im ken yesh lo banim" - a person may not cease from the mitzvah of being fruitful and multiplying unless he already has children, and as long as he has not yet fulfilled the mitzvah, he is obligated to make an effort to fulfill it. Further on we will address the question of what counts as "children" for this purpose.
The Gemara clarifies that even someone who has already had many children and has fulfilled the mitzvah of being fruitful and multiplying must still be married to a wife, as it says: "It is not good for man to be alone."
How many children are required to fulfill the mitzvah?
Beis Shammai: "shnei zecharim" - he needs two sons in order to fulfill the mitzvah. This ruling is derived from Moshe Rabbeinu, who separated from his wife after two sons were born to him.
Beis Hillel: "zachar u'nekevah" - one son and one daughter suffice, as it says regarding Adam and Chavah: "male and female He created them" - the Holy One, blessed is He, created them male and female, and in this way the world endures and continues.
One who married a woman and remained with her ten years:
The mishnah continues and discusses one who is married and has no children: "Nasa ishah v'shahah imah eser shanim v'lo yaldah - eino rashai libatel" - after ten years of waiting during which no children were born, he may not cease from the mitzvah of being fruitful and multiplying, and therefore he must divorce her or marry an additional wife.
The source for the measure of ten years is Avraham Avinu. Even though Avraham was married for many years before he arrived in Eretz Yisrael, the years spent outside the Land are not counted, since it is possible that he needed the merit of Eretz Yisrael. Once ten years had passed in Eretz Yisrael and no children were born to them, Sarah gave him Hagar, and from her Yishmael was born.
It is worth noting that a careful look at the sugya reveals that the Gemara states that Avraham was naturally barren, and the birth of his sons was in the category of a miracle; therefore one cannot derive practical halachah from his conduct. The halachah is derived, as the Gemara says and as Rashi explains, from a superfluous phrase in a verse stated regarding Avraham, and from there we know that this ruling applies only after ten years.
The woman's status in a subsequent marriage:
If he divorced his first wife after they had no children for ten years - "mutar linasei l'acher" - she is permitted to marry another man, since we do not assume that the barrenness stems specifically from her; it may well stem from him. "V'hasheni" - the second husband too may remain with her for ten years. However, according to our mishnah she should not marry a third time after she has had no children from the first two, though she may marry someone who has already fulfilled the mitzvah. And if she became pregnant and miscarried, the count of ten years begins anew from that miscarriage.
Who is obligated in being fruitful and multiplying:
The mishnah establishes that the man is obligated in the mitzvah of being fruitful and multiplying, while the woman is not obligated in it. Rabbi Yochanan ben Beroka disagrees and holds that the mitzvah was stated to both of them, for the Holy One, blessed is He, told Adam and Chavah in the plural that they should be fruitful and multiply, and therefore the woman is obligated as well. However, the halachah does not follow Rabbi Yochanan ben Beroka, and a woman is not obligated by Torah law in being fruitful and multiplying.
In summary: In this mishnah we learned that a person may not cease from the mitzvah of being fruitful and multiplying until he has fulfilled it - according to Beis Shammai with two sons and according to Beis Hillel with a son and a daughter - and even after he has fulfilled it he must be married, because "it is not good for man to be alone." We addressed the ruling regarding one who remains with his wife ten years without children, its source in Avraham Avinu and the derivation from the superfluous phrase in the verse, the woman's permission to marry a second husband and the limitation on a third marriage, and the fact that the mitzvah rests upon the man and not upon the woman.