Praise be to Allah.
What you must do before regretting having the abortion and asking about the consequences of your action is regret having committed zina, which led to the creation of this embryo, and you should ask about how to repent from it, because zina is a major sin and a grave immoral action; it incurs the wrath and punishment of Allah, may He be exalted, and it is deserving of the hadd punishment in this world.
First of all, you must regret it sincerely and repent sincerely from having committed zina, and you must firmly resolve never to go back to that sin. You must also do a lot of righteous deeds and seek to keep yourself chaste by means of permissible marriage, so as to protect yourself from the tricks of the devils among mankind and the jinn, lest they cause you to slip once more. Sever all ties with Jaahiliyyah and bad company that may open the door to immoral and indecent actions.
With regard to the embryo that you aborted, if that happened before the soul was breathed into it – i.e., before four months, as we believe is the more correct view – then you do not have to offer any expiation or pay any diyah (blood money). If it was after the completion of four months, then you have incurred the burden of sin and must pay the diyah and offer expiation. The diyah is the equivalent of the price of five camels; the expiation is to fast for two consecutive months.
With regard to your prayers and fasts not being accepted for forty days, this is a false notion for which there is no sound basis. Perhaps the one who said it meant that you would be in the state of nifaas (postpartum bleeding), during which a woman does not pray or fast. This is correct if you the bleeding is the blood of nifaas; it would not be permissible for you to fast or pray for the duration of that bleeding, which came to you as a result of the abortion. Then when the bleeding stopped and you saw the signs of purity that you are used to, then you should purify yourself (ghusl) and pray and fast. Then when the month of Ramadan ends, you should make up the days on which you did not fast during your nifaas.
But if he meant that your prayers and fasts were not valid throughout the period mentioned, even if you were not bleeding in nifaas, then this is wrong and it is indeed false.
So carry on praying and fasting, and persist in repenting and praying for forgiveness for the major sin that you committed. We ask Allah, may He be exalted, to accept your repentance and forgive your error.
And Allah knows best.