Yes living things can survive being exposed to space, but navigating is much more difficult.
As you probably know by now, Tardigrades (moss piglets) are microscopic bacteria eating critters that can survive extremely well in harsh conditions. They hibernate through the hard times in a pretty much dead state like a dried raisin, this process is called cryptobiosis. As the tardigrade loses water, its cells are filled with proteins that protect everything from breaking down.
Some of them can withstand extremely cold temperatures down to 1 K (−458 °F; −272 °C) (close to absolute zero), while others can withstand extremely hot temperatures up to 420 K (300 °F; 150 °C) for several minutes, pressures about six times greater than those found in the deepest ocean trenches, ionizing radiation at doses hundreds of times higher than the lethal dose for a human, and the vacuum of outer space.
Rehydrate them and they revive pretty much unharmed.
Navigating in space is hard. Evolving that ability is next to impossible.
Why don't we see space whales? Multiple reasons: How did they fly to such high altitudes? How do they survive in the deadly conditions of space? What do they eat? And what's worse space is vast and empty with literally astronomical distances separating them from anything of interest.
What's more if you want these things to evolve naturally the process needs to be gradual (on top of needing a reason to go there). As per the issues I mentioned earlier the harsh conditions are most likely to kill a creature that flew so high before it ever has the chance to adapt to them. Or a miracle happens and it does, you never know.
If the planet explodes, or a volcano violently erupts, sending life into space it would have 1. No time to adapt 2. No way of steering where it's going. And space is vast so the chances of coming near anything are low. With luck they might get sucked into a star. But yes, bacteria could perhaps survive in a cavity in an asteroid and hit a planet. Hopefully hospitable but most likely not.
If you leave it up to chance it's impossible. But perhaps if life is bioengineered to space travel then maybe...