The two reasons for vertebrates to evolve from oviparity (
Egg-laying) to viviparity (Giving live birth) are :-
1. To increase the number of successful births as in viviparity
the offspring is protected by the mother whereas in oviparity eggs
laid can easily be eaten by other animals. Hence viviparity is
selected by natural selection and they evolved to viviparity.
2.In oviparity the youngs developed are mostly poor as no care
is given by the mother. In viviparity the youngs get full care from
the mother in terms off oxygen and nutrients so the youngs
developed are more healthy in viviparity. So they were selected by
natural selection and were evolved to viviparity.