We investigate the equilibrium and real-time properties of the spin correlation function $\langle \vec{S}_1\vec{S}_2 \rangle$ in the two-impurity Kondo model for different distances $R$ between the two-impurity spins. It is shown that the competition between the Ruderman-Kittel-Kasuya-Yosida (RKKY) interaction and the Kondo effect governs the amplitude of $\langle \vec{S}_1\vec{S}_2 \rangle$. For distances $R$ exceeding the Kondo length scale, the Kondo effect also has a profound effect on the sign of the correlation function. For ferromagnetic Heisenberg couplings $J$ between the impurities and the conduction band, the Kondo effect is absent and the correlation function only decays for distances beyond a certain length scale introduced by finite temperature. The real-time dynamics after a sudden quench of the system reveals that correlations propagate through the conduction band with Fermi velocity. We identify two distinct timescales for the long time behavior which reflects that for small $J$ the system is driven by the RKKY interaction while for large $J$ the Kondo effect dominates. Interestingly, we find that at certain distances a one-dimensional dispersion obeying $\epsilon(k)=\epsilon(-k)$ may lead to a local parity conservation of the impurities such that $\langle \vec{S}_1\vec{S}_2 \rangle$ becomes a conserved quantity for long times and does not decay to its equilibrium value.