The law is full of seemingly incongruent cases like this. In many cases, I think it has to do with rights and ownership and agency.
For example, it is illegal to j-walk and it is also illegal to hit the j-walker with your car, even though they are breaking the law.
It is illegal to burn down someone else’s house, but you can burn your own house down legally (as long as you don’t make an insurance claim.)
It’s illegal to speed, but it is also illegal - some states - to drive down the left lane blocking those trying to speed.
These are of course trivial things when compared to abortion.
Still, the same sort of rule applies. If you deprive someone of their healthy pregnancy, which will become a child, that is an affront. But if a pregnant mother cannot or is unwilling to carry the pregnancy, that is at the same time her choice - and as pointed out in the several current articles here regarding abortion, there are many reasons someone might make such a choice.