You need to keep reading. Exodus 21:22-25:
"If men fight, and hurt a woman with child, so that she gives birth prematurely, YET NO HARM FOLLOWS, he shall surely be punished accordingly as the woman’s husband imposes on him; and he shall pay as the judges determine.
****BUT IF ANY HARM FOLLOWS, THEN YOU SHALL GIVE LIFE FOR LIFE, eye for eye, tooth for tooth, hand for hand, foot for foot, burn for burn, wound for wound, stripe for stripe."****
It's telling us that when we harm a child in the womb and causes the mother to prematurely deliver but there is no further harm to the child, then a fine is warranted. However, if harm does follow, such as death, the punishment is death. This is what it means "eye-for-eye, tooth-for-tooth," etc.