All perfect praise be to Allah, The Lord of the Worlds. I testify that none is worthy of worship except Allah and that Muhammad, is His slave and messenger.
Abortion is prohibited at any stage of pregnancy according to the preponderant opinion of scholars. The sinfulness is greater if the abortion is done after the soul has been breathed into the fetus, because abortion in this case is considered killing a soul that Allah has prohibited killing except for a rightful cause.
Therefore, you are sinful for having the abortion, especially that you did so after consulting with a Shaykh who informed you of the prohibition in this regard. You should have complied with the religious ruling and avoided this sin.
Accordingly, it is obligatory on you to repent to Allah sincerely of the sins of abortion and adultery.
For more benefit on the conditions for repentance, please refer to Fatwa 86527.
Since the abortion took place after the fetus had been formed, you are thereby liable to pay a Diyah (blood money) equal to one-tenth of the value of the Diyah of the fetus' mother; which is approximately equivalent to 213 grams of gold, payable to the fetus' rightful heirs; each is entitled to his or her due share according to the Islamic Law of Inheritance, and you are excluded from the inheritance.
It is impermissible for a man to marry a woman who became pregnant on account of unlawful sexual intercourse she had had with him, according to the opinion of the majority of the jurists. The illegitimate child she gives birth to is not traced back to him.
However, Abu Haneefah maintained that it is permissible for him to marry her and the child is traced back to him. The view adopted in Islamweb is that of the majority of scholars.
However, since the marriage has already been conducted, there is no harm in following the view of Abu Haneefah in this regard, declaring the marriage valid and tracing the child back to the biological father. Accordingly, he would be entitled to his due share of the Diyah.
Allah knows best.