Translation:Stretch your muscles to exercise!
I think no, it is not an imperative use. Rather it is an "X is Y" kind of statement. What's being said here is that "stretching muscles ... is very important". "Streĉi la muskolojn ... gravas" (estas grava).
Interestingly, if you take these 3 steps, you still end up with a meaningful sentence with a very similar meaning: Start with Streĉu, remove "tre gravas", replace all "oni" with "vi".
I wonder if the “…dolori al oni…” is obligatory here—and would “…dolori onin…” be equally acceptable, but just “…dolori…”, would not? In the dolor[aiou]s tenses, it’s not uncommon to see both reflexive dolori and bare dolori and I wonder if the bare dolori would work here.