Space travel is not air travel
You are comparing aircraft to spacecraft. This is not a good comparison.
- Aircraft move in the air, the atmosphere
- Spacecraft move in space
Why do aircraft use fossil fuels but spacecraft do not? Well they do actually; for instance some spacecraft use(d) kerosene as their main propellant, the most conspicuous example being the Saturn V, the biggest rocket that ever flew successfully.
Some other rocket engines do not use fossil fuels though. The Space Shuttle had main engines that used hydrogen and oxygen. Hydrogen and oxygen burns cleanly and forms only pure water. Why do aircraft not use that?
This is because an aircraft engine is expected to be used for thousands of hours and to be very cost effective. A rocket engine is usually meant to be used for less than 10 minutes, and you do not really care much about the fuel cost of a rocket engine. And while it is very easy to make a rocket engine that can use hydrogen and oxygen as fuel, we have still not been able to do that with aircraft engines. We simply do not yet have the technology to make internal combustion engines that use hydrogen and oxygen as fuel. If we could, we would have solved a lot of environmental problems. The work to achieve that is ongoing.
What happens with the exhaust from rocket engines you ask. It is simply left in the atmosphere to be diluted by the rest of the air. And since space travel is exceedingly rare compared to air travel, by a factor of more than a million, the contribution to pollution by rocket engines is simply too small to be noticed.
What can we do to keep space travel (and air travel) "clean"?
- Use fuel that can be manufactured without leaving a big footprint. The aforementioned hydrogen-oxygen combination mentioned before is good at that, if you use clean electricity to make the hydrogen oxygen.
- Use fuel that does not leave exhaust that affect the environment adversely. Actually RP-1 (kerosene) that the Saturn V used was quite good for that, leaving only water and carbon dioxide behind. But again, the hydrogen-oxygen combination is a good one.