In The Handmaid's Tale, the inspiration for the handmaids comes from the Biblical story of Rachel. Rachel, who was barren, married her husband Jacob to her servant, Bilhah, so that Bilhah would have children in her place. In the book, the relevant passages are quoted as:

Give me children or I will die. Am I in G-d's stead, who hath withheld from thee the fruit of the womb? Behold my maid Bilhah. She shall bear upon my knees, that I may also have children by her.

These passages are excerpted from Genesis 30:1-5. (from the New American Standard Bible)

1. Now when Rachel saw that she bore Jacob no children, she became jealous of her sister; and she said to Jacob, "Give me children, or else I die.''
2. Then Jacob's anger burned against Rachel, and he said, "Am I in the place of G-d, who has withheld from you the fruit of the womb?''
3. She said, "Here is my maid Bilhah, go in to her that she may bear on my knees, that through her I too may have children.''
4. So she gave him her maid Bilhah as a wife, and Jacob went in to her.
5. Bilhah conceived and bore Jacob a son.

In some ways, the Gileadeans of The Handmaid's Tale were very literal in their interpretation of these passages. For example, when a handmaid gave birth, she did so physically squatting between the knees of the wife to whom the baby would belong, so that she would literally "bear upon.." the wife's "knees". However, the handmaids were not actually wives in the families that they served (as opposed to Bilhah and Zilpah). As soon as a handmaid gave birth, or if sufficient time had passed to indicate that she would not succeed in conceiving, she was traded to another house, to try again.