The series of events required for an organism to receive a mechanical stimulus relating to a magnetic field, convert it to a molecular signal, and recognize and characterize the signal. A magnetic field exerts a torque on a ferromagnetic material (e.g. magnetite) or on a material with diamagnetic anisotropy; organisms that can detect this torque can use it to determine the orientation of the magnetic field.