Consider a compact manifold M with boundary ∂ M endowed with a Riemannian metric g and a magnetic field Ω. Given a point and direction of entry at the boundary, the scattering relation Σ determines the point and direction of exit of a particle of unit charge, mass, and energy. In this paper we show that a magnetic system (M,∂ M,g,Ω) that is known to be real-analytic and that satisfies some mild restrictions on conjugate points is uniquely determined up to a natural equivalence by Σ. In the case that the magnetic field Ω is taken to be zero, this gives a new rigidity result in Riemannian geometry that is more general than related results in the literature.