22 If men strive, and hurt a woman with child, so that her fruit depart from her, and yet no mischief follow: he shall be surely punished, according as the woman's husband will lay upon him; and he shall pay as the judges determine.
23 And if any mischief follow, then thou shalt give life for life,
24 Eye for eye, tooth for tooth, hand for hand, foot for foot,
25 Burning for burning, wound for wound, stripe for stripe.
God does not see human life, even in the womb, as worthless. This is why an unborn child is protected in these verses. If two men get into an argument, or are rough-housing playfully, and they accidently hurt a woman who is nearby who is pregnant, and then they stop to see to the woman and her child out of concern, being repentent of their behavior, they still have to pay for the loss of the child at the father's mercy. God lets the father of the child determine the worth of his progeny to him at this point.
However, if they don't care who they hurt in their fighting, God demands the same punishment as if they had murdered someone in cold blood.