We derive the spin-wave dynamics of a magnetic material from the time-dependent spin-density-functional theory in the linear response regime. The equation of motion for the magnetization includes, besides the static spin stiffness, a "Berry curvature" correction and a damping term. A gradient expansion scheme based on the homogeneous spin-polarized electron gas is proposed for the latter two quantities, and the first few coefficients of the expansion are calculated to second order in the Coulomb interaction.