Exod 21:22-23 is a popular prooftext for Christian prolifers. It's the only Biblical passage that speaks directly to the issue of abortion–although many Biblical passages have a general bearing on that issue. However, appeal to that passage is complicated by the ambiguous syntax. Does the injury and penalty have reference to the mother or the baby?
That question probably poses a false dichotomy. Case law is flexible. It's meant to give OT judges guidance on how to adjudicate certain kinds of situations. Similar situations. If this law doesn't single out the mother or child, the syntactical ambiguity is likely intentional. The law is meant to cover both parties–depending on what happens in real life. Case laws present hypothetical examples that have rough, real-world analogues. So prolifers are right to quote this passage. Even if it doesn't specify the baby, it does include the baby.
After exegeting the passage, Garrett helpfully makes that additional point:
This law envisages a scene in an Israelite village in which two men are fighting and the wife of one runs out to assist her husband The wife happens to be pregnant, and in the ensuring melee the woman is struck and goes into labor. If there is no fatal injury, the adversary of the husband might only have to pay a fine as determined by a jury, after it had considered the aggrieved husband's demands in light of what they know of the situation. If there is a fatal injury, the punishment could be as severe as execution ("life for life"; 21:23b). Unfortunately, an important detail about the law is unclear: it is impossible to tell whether the "fatal injury" is to the mother or the child.
Probably there is deliberate ambiguity in the text to allow juries latitude in dealing with the varieties of cases that might arise.
Why does the Bible mention the fight, a detail that seems altogether unnecessary and even somewhat contrived, and why does it not speak more directly of striking a pregnant woman (that is, of striking her deliberately), as these other [ANE] codes do?
I believe that the reason is that a woman who behaved in this way, diving into a brawl while pregnant, might be considered to have brought her troubles on herself. Such behavior would be foolish in the extreme; it practically invites serious medical complications. But this is the whole intent of the law: it is meant to drive home the lesson that a man must be very careful about violence in the presence of a pregnant women, even when the woman herself is behaving irresponsibly. He would do better to flee the scene than to carry on with the fight knowing that he might cause serious injury to the woman and child. It is also significant that the law assumes that the other man, not the woman's husband, is responsible for the injury.
…special protection is afforded to a pregnant woman and her unborn child in this legislation; no other kind of bystander at a village quarrel (an old person, a woman who is not pregnant, or a young child) is given such considerations. If nothing else, therefore, the law indicates that a strong instinct for protecting the unborn is appropriate. D. Garrett, A Commentary on Exodus (Kregel 2014), 500-503.