Live birth is a comparatively recent adaptation. Monotreme mammals do still lay eggs. It is the marsupial and eutherian mammals which developed live birth. Actually,the embryo developing in the womb has the same membranes round it as does the embryo inside a bird egg. Mammals give birth to live young because the development takes place internally. Live birth has evolved independently a number of times in reptiles, for example Ichthyosaurs gave birth to live young. So do some snakes.