This is a common misperception.
In almost all those cases those unborn children are not considered legal persons per se. The cases that seem to allow this concept are generally property cases. The law allows that these unborn children do have claims on property if they are born. In the case the case where the unborn dies before birth, the title of the property is not shown to have ever been in possesion of the unborn.
For example, death taxes. A person dies leaving property to an unborn. The property of the person who died is subjected to a death tax. If the unborn dies before birth, there is not another death tax levied. The property goes to the next person who has claims.
Actually I was referring to cases in which people were charged with manslaughter for killing an unborn child due to traffic accidents, shootings and other acts.