The maidservant as surrogate mother
When a wife had no children, she could give her maidservant to her husband so that children born — “on my knees,” says Rachel (30:3) — counted as hers, as Sarah did with Hagar, and Rachel and Leah with their maids. It is a custom documented in Ancient Near Eastern contracts.
Where it comes from
It was a legal custom of the Ancient Near East: a barren wife could give her maidservant to her husband to bear children on her behalf, and those children counted as the wife's. It is reflected in Mesopotamian law codes and contracts.