Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
It is permissible for the pregnant woman to breastfeed her child until the end of the breastfeeding period which is two whole years.
It is reported in Sahih Muslim that Judama bint Wahab Al-Assadia heard the Prophet (Sallallahu Alaihi wa Sallam) saying: "I was about to forbid Al-Ghila (having intercourse with one's wife while she is breastfeeding), and then I remembered that the Romans and Persians do so, and it does not harm their children."
Imam Al-Nawawi said when interpreting Sahih Muslim: 'Al-Ghila is the fact that husband has sexual intercourse with his wife while she is breastfeeding.'
Ibn As-Sikket said: 'It means that the woman is breastfeeding while she is pregnant.'
The scholars said that the reason for which the Prophet (Sallallahu Alaihi wa Sallam) was about to forbid a woman to breastfeed while pregnant is the fear that the child be harmed.
They also said that the doctors state that when a woman is breastfeeding while pregnant, her milk is an illness, and the Arabs hate it and fear it.
According to the Hadith, Al-Ghila is permissible as the Prophet (Sallallahu Alaihi wa Sallam) did not forbid it, but clarified why he did not forbid it.
Therefore there is no harm for a pregnant woman to breastfeed her child, if there is no harm for the child or the fetus.
The harm can be determined by referring to trustworthy doctors.
Allah knows best.