The objective of this study was to identify subgroups among the participants in inpatient multidisciplinary musculoskeletal rehabilitation based on the differences in the shapes of trajectories of pain medication consumption during the 9 years around the time of intervention. A register-based study among 4578 public sector employees was conducted. Group-based trajectory analysis was done on the purchase of prescribed pain medications during the 9 years around the time of rehabilitation. The participants were on an average 50.7 (SD=6.6) years of age, and 2955 (86%) were women. Average yearly purchase of pain medications increased during the follow-up period from 73.4 (SD=193.0) to 163.3 (SD=295.7) defined daily doses. The analysis suggested six-cluster model. The shapes of the trajectories of three clusters did not show any steep slopes, one trajectory demonstrated nonstop rising through the entire follow-up, and one trajectory was closed to the trajectory average of medication use. One trajectory (11% of the sample) demonstrated a steep growth before the intervention and steep drop after it. When comparing this cluster with all other clusters combined, odds ratios were 0.40 [95% confidence interval (CI): 0.19–0.85] for age group (older vs. younger), 0.78 (95% CI: 0.61–1.01) for sex (women vs. men), and 1.44 (95% CI: 1.09–1.90) for occupational status (lower vs. higher). In other words, the participants belonged to this cluster were younger employees with a lower occupational grade. It seems that younger employees in manual jobs benefitted of the studied multidisciplinary musculoskeletal rehabilitation the most, especially when the timing of intervention is bounded to the substantial rise of pain severity.