Literature
Static configurations of the magnetization $\mathbf{m}(\mathbf{x})$ minimize the magnetic energy $E(\mathbf{m})$.
We will consider only the exchange energy. We have the Lagrangian density
$$ \mathcal{L} = \frac{1}{2}\, \partial_x\mathbf{m}\cdot\partial_x\mathbf{m}. $$
We have to consider the constraint $\mathbf{m}^2 = 1$. The constraint is imposed via a Lagrange multiplier $\lambda(x)$ [Raj, Sec. 3.3][Yan, Sec. 2.1.1][FG, Sec. 12.2].
We have to extremize the functional
$$ L[\mathbf{m}] = \int dx \underbrace{\left[ \frac{1}{2}\,\partial_x\mathbf{m}\cdot\partial_x\mathbf{m} + \frac{\lambda(x)}{2} (1-\mathbf{m}^2) \right]}_{\mathcal{L}}. $$
The Euler-Lagrange equation
The functional $L$ is minimized for $\mathbf{m}(x)$ that satisfies the Euler-Lagrange equation
$$ -\frac{\delta L}{\delta \mathbf{m}} = 0 \Rightarrow \frac{d}{dx}\left(\frac{\partial \mathcal{L}}{\partial(\partial_x\mathbf{m})}\right) - \frac{\partial\mathcal{L}}{\partial\mathbf{m}} = 0.
$$
We calculate
$$ -\frac{\delta L}{\delta \mathbf{m}} = \frac{d}{dx}\left( \partial_x\mathbf{m} \right) + \lambda \mathbf{m} = 0 $$
or
$$ \partial_x^2 \mathbf{m} + \lambda \mathbf{m} = 0. $$