Flexible structures with reprogrammable nonlinear mechanical responses—capable of being reversibly switched post-fabrication—hold immense potential for advancing soft robotics, wearable devices, and energy-absorbing systems. However, developing such adaptable materials remains a significant challenge. In this work, we present a flexible mechanical metamaterial with embedded rigid magnets that can be reprogrammed by simply altering their orientation to achieve desired nonlinear mechanical responses. First, we demonstrate that periodic changes in magnet orientation enable a broad spectrum of mechanical behaviors. Building on this, we introduce an inverse-design framework, leveraging a fully differentiable simulation environment, to discover non-periodic magnet orientations that achieve specific target nonlinear static and dynamic responses, which are experimentally validated. These results highlight magnetic interactions as a powerful platform for developing reprogrammable systems, paving the way for the next generation of smart structures and devices.