Hard-magnetic soft materials (HMSMs) manufactured by embedding hard-magnetic particles in soft materials belong to a new type of soft active materials. The abilities of fast and complicated transformations of hard-magnetic soft structures provide a promising technology for soft robotics, flexible electronics, and biomedical devices. It is significant to investigate the mechanical behaviors of hard-magnetic soft structures for their better applications. In this work, a hard-magnetic soft beam under an external magnetic field is theoretically modeled and the exact solutions for its mechanical responses are presented. First, the governing equations and boundary conditions are derived based on the principle of minimum potential energy. To solve the derived governing equations analytically, a new polynomial fitting model for hyperelastic materials is proposed for the hard-magnetic soft beam. Then, the exact solutions of a cantilevered hard-magnetic soft beam actuated by a uniform magnetic field in any direction are obtained. The newly derived exact solutions are further verified by comparing current results with those from recent simulations and experiments. For large bending angles up to 90 deg and extreme bending angle up to 180 deg, quite consistent agreement among exact solutions, numerical simulations, and experimental observations can be achieved. Finally, using our theoretical model, the deformation of the hard-magnetic soft beam actuated by magnetic fields in an arbitrary direction with non-zero magnetic declination is explored. When the magnetic actuation is increased from a small level gradually, the hard-magnetic soft beam deflects and it would undergo small, large, and extreme bending deformations in sequence. It is very interesting that, when the magnetic actuation is sufficiently large, the hard-magnetic soft beam is stretched and its centerline tends to align with the external magnetic field direction, implying that the hard-magnetic soft beam undergoes a uniaxial tension. The theoretical modeling and exact solutions for hard-magnetic soft beams are expected to be useful in the analysis and design of soft materials and structures.