Based on first-principles calculations, the structural, magnetic, dynamic properties, and the $\ensuremath{\alpha}$-hexagonal $\ensuremath{\rightarrow}$ $\ensuremath{\beta}$-orthorhombic $\ensuremath{\rightarrow}$ $\ensuremath{\gamma}$-hexagonal phase transitions of ferromagnetic, antiferromagnetic, and paramagnetic MnAs are studied. The phonon-dispersion curves for some of the phases were derived using the direct method. Soft modes were found in ferromagnetic and antiferromagnetic structures in a wide range of pressures. A strong dependence of the soft-mode energy on the magnetic moment and magnetic order was revealed. The double-well potential was found as a function of the soft-mode amplitude at the reduced crystal volume. In the $\ensuremath{\beta}$-orthorhombic phase, a new antiferromagnetic configuration consisting of linear chains of alternating spins was found. Therefore, the mechanism of the magnetostructural phase transitions confirms the antiferromagnetic or paramagnetic (with antiferromagnetic fluctuations) state of the $\ensuremath{\beta}$-orthorhombic phase. The paramagnetic $\ensuremath{\gamma}$-hexagonal phase is stabilized at high temperature in the displacive second-order phase transition owing to the disappearance of the soft mode.