We consider nuclear-spin dynamics in a two-electron double dot system near the intersection of the electron spin singlet $S$ and the lower energy component ${T}_{+}$ of the spin triplet. The electron spin interacts with nuclear spins and is influenced by the spin-orbit coupling. Our approach is based on a quantum description of the electron spin in combination with the coherent semiclassical dynamics of nuclear spins. We consider single and double Landau-Zener passages across the $S$-${T}_{+}$ anticrossings. For linear sweeps, the electron dynamics is expressed in terms of parabolic cylinder functions. The dynamical nuclear polarization is described by two complex conjugate functions ${\ensuremath{\Lambda}}^{\ifmmode\pm\else\textpm\fi{}}$ related to the integrals of the products of the singlet and triplet amplitudes ${\mathrm{c\ifmmode \tilde{}\else \~{}\fi{}}}_{S}^{*}{\mathrm{c\ifmmode \tilde{}\else \~{}\fi{}}}_{{T}_{+}}$ along the sweep. The real part $P$ of ${\ensuremath{\Lambda}}^{\ifmmode\pm\else\textpm\fi{}}$ is related to the $S$-${T}_{+}$ spin-transition probability, accumulates in the vicinity of the anticrossing, and for long linear passages coincides with the Landau-Zener probability ${P}_{\mathit{LZ}}=1\ensuremath{-}{e}^{\ensuremath{-}2\ensuremath{\pi}\ensuremath{\gamma}}$, where $\ensuremath{\gamma}$ is the Landau-Zener parameter. The imaginary part $Q$ of ${\ensuremath{\Lambda}}^{+}$ is specific for the nuclear-spin dynamics, accumulates during the whole sweep, and for $\ensuremath{\gamma}\ensuremath{\gtrsim}1$ is typically an order of magnitude larger than $P$. $P$ and $Q$ also show critically different dependences on the shape and the duration of the sweep. $Q$ has a profound effect on the nuclear-spin dynamics, by (i) causing intensive shakeup processes among the nuclear spins and (ii) producing a high nuclear spin generation rate when the hyperfine and spin-orbit interactions are comparable in magnitude. Even in the absence of spin-orbit coupling, when the change in the the total angular momentum of nuclear spins is less than $\ensuremath{\hbar}$ per single Landau-Zener passage, the change in the global nuclear configuration might be considerably larger due to the nuclear-spin shakeups. We find analytical expressions for the back action of the nuclear reservoir represented via the change in the Overhauser fields the electron subsystem experiences.