If you have two magnets and you brace them toghter but at a distance less the the force the magnets will push each other apart. Then by useing a switch to fire the back magnet which will push the front magnet foward could this be used to propel a spaceship through space.Also you would have to make the front magnet smaller then the back one so the force backwards wont counter the force foward and fire the back magnet 100 times per second.
If you just let the magnets push each other apart, then you are doing the same thing as a rocket engine, but with less speed.
If you are doing something to keep the rear magnet nearby (like putting an engine on it), then you would do better to just put that engine on the ship in the first place.
There doesn't seem to be a situation where mediating the interaction with magnets would make sense. Magnets are kind of neat at the small scale, but to work on something like a ship, it would have to be enormous or draw huge amounts of power. Can you imagine how big a magnet you'd need to just push a car?