Praise be to Allah.
Divorce (talaaq) during pregnancy is a valid divorce and counts as such. If a man divorces his wife when she is pregnant, then her ‘iddah lasts until she gives birth, and he may take her back during her pregnancy. If he divorces her a second time during the pregnancy, the divorce counts as such. If he takes her back then divorces her again during the pregnancy, this also counts as such and she becomes irrevocably divorced from him, so she is not permissible for him until she has been married to another husband.
What is commonly thought by some people is that divorce of a pregnant woman does not count as such, but there is no basis for that.
Ibn ‘Abbaas (may Allah be pleased with him) said: If a man divorces his wife once or twice when she is pregnant, then he has more right to take her back so long as she has not given birth. This is what Allah says (interpretation of the meaning): “and it is not lawful for them to conceal what Allaah has created in their wombs, if they believe in Allaah and the Last Day” [al-Baqarah 2:228]. This was narrated by Ibn Jareer al-Tabari in his Tafseer, 2/448, and by al-Bayhaqi, 7/367
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: Is it permissible to divorce a pregnant wife or not?
He replied: There is nothing wrong with divorcing a pregnant wife. The Prophet (blessings and peace of Allah be upon him) said to ‘Abd-Allah ibn ‘Umar, when he divorced his wife when she was menstruating: “Take her back and keep her until she becomes pure, then menstruates, then becomes pure, then menstruates, then divorce her if you wish when she is pure before you are intimate with her or she is pregnant.” End quote from Fataawa Islamiyyah.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: What is strange is that some of the common folk think that divorce during pregnancy does not count as such, but I do not know where they get this idea. Divorce during pregnancy does count as such; even if a man were to have intercourse with her when she was pregnant and divorce her before doing ghusl from janaabah, the divorce would count as such. So divorce of a pregnant woman is one of the most certain kinds of divorce. End quote from al-Liqa’ al-Shahri, 3/495
And Allah knows best.