The last time I checked (which was not recently) more than half of the various states in the USA had laws that make it a crime to cause harm to a fetus. Thus, someone who attacks a pregnant woman and kills the fetus she is carrying can face murder or manslaughter charges. In the UK, ‘child destruction’ is the name given to the offence of killing an unborn but viable fetus.
Here, as you have pointed out, there are two ethical issues that arise: 1) It seems contradictory that a woman can legally terminate a pregnancy through abortion while a third party might face legal charges if they kill the fetus; 2) Suppose the pregnant woman is a drug addict or an alcoholic. Should she also face some kind of charge if her fetus suffers from the effects of this?
Unfortunately, I cannot recall any discussions of abortion in the specialist literature that I have looked at (books by Peter Singer, Ronald Dworkin, Mary Warnock and Carol Sanger) that delve into the above questions, though I gather that some commentators have attempted to frame abortion within the context of justifiable homicide, for example, in cases of ectopic pregnancy, or perhaps if the pregnancy is a consequence of rape or incest.
On the other hand, in the 1980’s and 90’s, a fundamentalist anti-abortion Christian organisation called the Army of God were responsible for 8 murders, 41 explosions and 173 arson attacks at abortion clinics. According to Army of God beliefs, abortion is murder and the killing of hundreds of thousands of defenceless babies in those clinics is nothing less than a government approved ‘Holocaust.’ The doctors who work in them were viewed as committing crimes against humanity. Therefore murdering them was perceived as an act of justifiable homicide.
Here's Richard Dawkins interviewing one of them:
What I do remember is that ethicists have often taken issue with where dividing lines are drawn between when abortion is morally acceptable/legal and when it is not.
To take one example (birth rather than viability as the demarcation point), Colin McGinn has observed that if a fetus was scheduled to be aborted on a certain day but then the mother gave birth prematurely before her appointment, that it seems strange to think that it is now suddenly wrong and illegal to do what was previously seen as acceptable, simply because the baby has left the womb.
From this, he thinks we can conclude that what matters as far as the abortion issue is concerned is not
where the fetus is but
what it is: its stage of biological and mental development, or the potential it has to mature and develop into a human being.
Just on the issue of late terminations (which got mentioned upthread), these articles are both worth a look:
Mary Warnock: It's a great pity that we see attempts to restrict abortion in the new Human Fertilisation and Embryology Bill
www.theguardian.com
In the wake of Trump’s criticism of late-term abortions, three mothers shatter the misconceptions about why women make the choice
www.theguardian.com
Judith Jarvis Thomson also once wrote an influential article on abortion featuring some thought experiments that are often debated in ethics classes:
en.wikipedia.org
Carol Sanger's book
About Abortion: Terminating Pregnancy in Twenty-First Century America is the best book I have read on this subject. I suspect that a revised edition may now be warranted in the light of the Supreme Court decision.
Hope this helps.
I realize that I haven't answered your question but the above links and references should give you plenty to reflect on.