It's may be due to incorrect posture also,if ur not maintaining posture it leads to back muscles weakness,when ur doing exercises or lifting weights it leads to a strain of back muscles.
Next Steps
maintain posture and ergonomics also,don't lift heavy weights at gym after pain subside start with mild back mobilization exercises
Health Tips
visit nearby physiotherapy clinic for pain relief and mobilization exercises