All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
The prescribed medicine is for the benefit of the embryo for fear of miscarriage, and refraining from taking it may cause miscarriage at any stage of the pregnancy.
Consequently, we are of the view that it is impermissible for you to refrain from taking this medicine, because causing a miscarriage before the soul is blown into the embryo is impermissible according to opinion of a group of scholars.
The Shaafi‘i scholar, Al-Muhibb At-Tabari said, ‘Scholars held different opinions regarding the ruling on aborting the embryo before forty days of pregnancy. Some scholars say that it does not take the ruling of prohibited abortion or infanticide.’
However, other scholars are of the opinion that the embryo’s life must be respected; hence, they deem abortion to be prohibited.
On the other hand, if miscarriage was induced after the soul is blown into the embryo without a coercive necessity, then it is consensually prohibited.
Ad-Dardeer Al-Maaliki said, ‘It is impermissible to remove the semen from the womb after morphogenesis even before forty days according to the preponderant opinion of scholars, and after that consensually.’
Based on scholars' statements, it is clear that the questioner must take the medicine so as not to cause any harm to the embryo at any stage of the pregnancy.
Allaah Knows best.