A whiplash injury can alter neck muscle function, which remains years after the injury and may explain why symptoms such as persistent pain and disability occur. There is currently limited knowledge about dynamic neck muscle function in chronic whiplash-associated disorders (WAD), and about the extent to which altered muscle function can improve after rehabilitation. Ultrasound can detect mechanical neck muscle function by measuring real-time deformation and deformation rate in the muscles. This method was used for five dorsal neck muscles in participants with chronic WAD versus matched controls in resistant neck rotation. We obtained real-time, non-invasive ultrasound measurements using speckle tracking, multivariate analyses, and mixed-design ANOVA analyses. The results showed altered deformation in the three deepest neck muscle layers, with less deformation area in the WAD group compared to controls in rotation to the most painful side at baseline. Participants in the WAD group performed three months of neck-specific exercises, resulting in improved deformation in the deep neck muscles in WAD and with a similar deformation pattern to controls, and the significant group differences ceased. We reveal new and important insights into the capability of ultrasound to diagnose altered neck muscle function and evaluate an exercise intervention.