In this article, a microstructural model of the Heusler alloy with the shape memory effect caused by the application of an external magnetic field is constructed. The dynamics of the magnetization process are described using the Landau–Lifshitz–Gilbert equation. For the numerical implementation of the model using the finite element method, the variational equations corresponding to the differential formulation of the magnetic problem are used. Such an approach makes it possible to reduce (weaken) the requirements for the smoothness of the sought solution. The problem of magnetization of single crystals of the Ni2MnGa alloy, which has a “herringbone”-type martensitic structure (a twinned variant of martensite), is considered. In each element of the twin, the magnetic domains with walls of a certain thickness are formed. The motion and interaction of these walls and the rotation of magnetization vector in the walls and domains under the action of the external differently directed magnetic fields are studied. These processes in the Heusler alloy are also accompanied by the detwinning process. A condition for the detwinning of a ferromagnetic shape memory alloy in a magnetic field is proposed, and the effect of the reorientation (detwinning) of martensitic variants forming a twin on the magnetization of the material and the occurrence of structural (detwinning) deformation in it are taken into account. First, the processes of magnetization and structural deformation in a single grain are considered at different angles between the anisotropy axes of twinned variants and the external magnetic field. For these cases, the magnetization curves are constructed, and the deformed states are identified. The model described such experimental facts as the detwinning process and the jump in magnetization on these curves as a result of this process. It was shown that the jump occurred at a certain magnitude of the strength of the applied external magnetic field and a certain direction of its action relative to the twinning system. Then, based on the obtained results, deformed states arising due to the detwinning process were determined for various (isotropic and texture-oriented) polycrystalline samples, and magnetization curves taking into account this process were constructed for these materials.