It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Noble Prophet (peace and blessings be upon him) said: "When a man's slave woman gives birth to her master's child, then after the master's death, she is free."
Brief Explanation
(Explanation of Hadith 2609)
"Umm walad" refers to a slave woman who has borne a child from her master. Such a slave woman becomes free after the death of her master.
In one hadith it is stated: It is not permissible to sell or gift her; during his lifetime, the master may benefit from her, and after his death, she will be free.
From this hadith, it is understood that a slave woman who has given birth to her master's child is freed after his death; therefore, her sale and gifting are not permissible, as has already been clarified in the explanation. The majority of scholars have given the fatwa that the buying and selling of an umm walad is forbidden, whether the child is alive or not. However, according to Imam Dawud Zahiri rahimahullah, the sale of an umm walad is permissible, because it is narrated from Sayyiduna Jabir radi Allahu anhu that during the blessed life of the Messenger of Allah sallallahu alayhi wa sallam, we used to sell umm walad slave women, and the Prophet sallallahu alayhi wa sallam did not see any objection in it. However, there is a possibility in this narration that this practice continued until the prohibition of selling umm walad was established.
And Allah knows best.