A magnetic weapon is one that uses magnetic fields to accelerate or stop projectiles, or to focus charged particle beams. There are many hypothesized magnetic weapons, such as the railgun and coilgun which accelerate a magnetic (in the case of railguns; non-magnetic) mass to a high velocity, or ion cannons and plasma cannons which focus and direct charged particles using magnetic fields.
Railguns[1] use two parallel metal rails connected to a power supply. When a conductive projectile is placed between the rails, the circuit is completed and a magnetic field is created down the rails up to the point of the projectile. This creates a force which pushes the projectile along the track, accelerating it to great speeds until it leaves the rails and the circuit is broken.
Coilguns, on the other hand, have a barrel made up of coils of magnetic material. The projectile is placed between the coils, which have a pulse of electricity passed through them. This pulls the projectile into the centre of the coil. The coils further down the track are then pulsed in sequence at specific times, accelerating the projectile until it leaves the barrel.
Ion cannons are beam weapons that fire beams of ions (particles, i.e. atoms that have been affected in some way as to cause them to gain an electrical charge). Ion cannons are actually particle cannons; only the particles used are ionized. Due to their electrical charges, the fired ions also have the potential to disable electronic devices, vehicles, and anything else that has an electrical or similar power source. The inspiration for this effect arises from the electromagnetic pulse generated by nuclear detonations, which can be devastating to electronic devices.