Bending forward puts lot of stress on the structures which are holding the back for stability and mobility like muscles, ligaments, joints etc. Any of them can cause low back pain.
There might be a chance that it’s a muscle spasm and it can be because of anything. It needs a proper assessment to find out the cause.
Next Steps
Try not to do those movements which are aggravating the pain.
If the pain is recent/acute, do apply cold pack every 3 hourly for not more than 10-12 mins.
Health Tips
For right Exercises or stretchings, prior assessment is required to see what all muscles need to be strech.