"Give me a place to stand and with a lever I will move the whole world." (Archimedes of Syracuse)
In a slingshot maneuver:
- The planet is that place to stand: Its mass is so huge compared to your spaceship that you don't have any (realistic) chance of moving it.
- The force of gravity is your lever: You use gravity to pull your spacecraft as it passes by.
- Your spacecraft is "the whole world" here: It means the whole world to you, so what I've just told you is true from a certain point of view.
You plan on using magnetic forces as lever instead of gravitational, but you still need a place to stand. Unfortunately, no such place exists between Earth and Mars; the magnet's orbits would be disturbed the same as yours. The bigger they are, the less affected they will be, but unless they are really massive (like, Death Star massive) they will need constant orbital corrections.
In the end, you will spend a lot of energy putting the magnetic stations in place, and will need to keep them supplied with propellant just to provide a small kick to every passing ship. It would be more economical to just add a little extra punch to every Martian launch.
From the above linked Wikipedia page on slingshots:
A close terrestrial analogy is provided by a tennis ball bouncing off the front of a moving train. Imagine standing on a train platform, and throwing a ball at 30 km/h toward a train approaching at 50 km/h. The driver of the train sees the ball approaching at 80 km/h and then departing at 80 km/h after the ball bounces elastically off the front of the train. Because of the train's motion, however, that departure is at 130 km/h relative to the train platform; the ball has added twice the train's velocity to its own.
You would be bouncing tennis balls off supermarket trolleys, after a few bounces the trolley's movement has been disturbed. The fact that you use magnetic forces has little effect on the simple arithmetic of conservation of movement.