It didn't necessarily originate from those bodies. The panspermia hypothesis speculates that asteroids can act as a vehicle. That is, an asteroid strikes another body that has life, and microbes are transferred into space on the debris. How life actually originates is uncertain. read more
According to some versions of the theory of “panspermia”, meteorites are responsible for bringing the first primordial life to Earth. The theory holds that either very simple forms of life or the materials necessary for it to form are carried to Earth on comets or fragments of asteroids. read more