  We apply imaginary-time evolution, ${\rm e}^{-\tau H}$, to study relaxation
dynamics of gapless quantum antiferromagnets described by the spin-rotation
invariant Heisenberg Hamiltonian ($H$). Using quantum Monte Carlo simulations,
we propagate an initial state with maximal order parameter $m^z_s$ (the
staggered magnetization) in the $z$ spin direction and monitor the expectation
value $\langle m^z_s\rangle $ as a function of the time $\tau$. Different
system sizes of lengths $L$ exhibit an initial size-independent relaxation of
$\langle m^z_s\rangle$ toward its value the spontaneously symmetry-broken
state, followed by a size-dependent final decay to zero. We develop a generic
finite-size scaling theory which shows that the relaxation time diverges
asymptotically as $L^z$ where $z$ is the dynamic exponent of the low energy
excitations. We use the scaling theory to develop a way of extracting the
dynamic exponent from the numerical finite-size data. We apply the method to
spin-$1/2$ Heisenberg antiferromagnets on two different lattice geometries; the
two-dimensional (2D) square lattice as well as a site-diluted square lattice at
the percolation threshold. In the 2D case we obtain $z=2.001(5)$, which is
consistent with the known value $z=2$, while for the site-dilutes lattice we
find $z=3.90(1)$. This is an improvement on previous estimates of $z\approx
3.7$. The scaling results also show a fundamental difference between the two
cases: In the 2D system the data can be collapsed onto a common scaling
function even when $\langle m^z_s\rangle$ is relatively large, reflecting the
Anderson tower of quantum rotor states with a common dynamic exponent $z=2$.
For the diluted lattice, the scaling works only for small $\langle
m^z_s\rangle$, indicating a mixture of different relaxation time scaling
between the low energy states.
