Sometimes we can see these particles striking the atmosphere in the auroras that form near the poles. Curiously, not all planets have their magnetic poles close to their north geographic poles, or even pointing in the same direction. The Earth's north magnetic pole is actually in the southern hemisphere, in the Antarctic south of Australia. But the north magnetic poles of Jupiter and Saturn both lie in their planet's northern hemispheres, near their north geographic poles. Uranus' and Neptune's magnetic poles are located closer to their equators.
Magnetism does indeed work perfectly well in space.
Most interplanetary spacecraft carry a 'magnetometer', which is a device to measure the strength of the magnetic field wherever the craft travels. Even the space between the planets has a magnetic field, though it is much weaker.