The commonly-suggested treatment is to perform weight training- squats, deadlifts, lunges, rows, pull-ups, core stability exercises like planks and suitcase carries, anti-rotation core exercises like pallof presses. The idea is to strengthen weak muscles to improve muscle imbalances and stabilize your body when you move.
Exercise alone may or may not work. You need to screen for the root cause. This is a bit more involved, and the best advice I can give is to find a really good physical therapist and/or read "Rebuilding Milo". There's an entire chapter dedicated to back pain- anatomy, how to screen for back pain, classifying the back pain, and treatment. Other chapters are dedicated to hip and ankle. These joints can also be a cause too.
You can step away from your sitting position more often or buy a fancy chair but exercise is the ultimate solution here.