The key to preventing injuries on the piano is to abide by the same principle used in medicine - the Hippocrates Oath.
Primum non nocere - First do no harm.
If you feel pain when you play, modify your approach.
Often, this applies to the hand position, wrist position, and fingering a student uses.
Always seek out the fingering that feels comfortable in the hands. Avoid movements that create tension and strain.
Sometimes it takes some time to find the best fingering approach, but you will know if you are forcing yourself unnecessarily by listening to the messages in your hands.
This is what good technique looks like: The fingers are be stable with a slight curve. The hands are level with the wrist. The feeling of downward pressure originates from the torso and full arm, not just from the wrist.
When you feel pain, simplify and go back to basics. Play single 5 note lines and focus on the foundational movements.
You have to walk before you can run.
It makes no sense to attempt playing left hand 10ths before you have mastered simple octaves and 6ths.
Remember also that Herculean practice efforts do more harm than good. It is more effective to break long practice sessions into several chunks, rather than trying to practice for 5 hours at once.
Learn more about effective practice here.