The problem of two particles interacting through the Hubbard potential on a 1 D finite lattice in a constant uniform magnetic field is solved. Exact wave functions are determined, and an equation for the energy spectrum is constructed and analyzed. The possibility of a field-induced singlet-triplet transition is demonstrated.