Removing their powers is clearly a bad idea, as you've stated. Players really don't like that. So you're left with
- Don't go to space
- Change the game so magic works in space just like it works elsewhere
- Invent a reason why magic-users can go to space and still use magic for this mission
So give them an item of some sort which lets them use magic safely if they're inside its effective radius, or carrying it on their person, or whatever. It's very rare, it's possibly experimental and may or may not always function, but it's good enough that they can expect to be useful while off-planet.
Then make sure it gets lost, or stolen by a charming band of child pickpockets (spontaneous group singing by said band of child pickpockets is entirely optional), or damaged.
If it's an unreliable item, maybe alongside the chance of failure make sure there's a chance that things will turn out better than expected - maybe it overpowers 5% of spells, which could be good or bad depending on what kind of spell it is and what you're using it for.
Or maybe it works perfectly, but was created by a process so atrocious that the characters are going to be very reluctant to carry on using it once they find out how it works.