Injuries happen in mountain biking. The golden rule in mountain biking safety is finding the balance between riding safe and progressing your skills. There exists a fine line between safety and pushing your limits. Saying this, it is inevitable that at some point if you continue progressing your riding skills that you will get injured.
There are 2 options when you're injured:
1) Sulk and lament about your injury while listening to your friends' stories about having fun on the trails.
2) Focus on your recovery and keep physically active in order to speed up the recovery process.
I've documented my recent ankle injury in the following video along with my detailed recovery and return to the sport.
Please note that each recovery program should be tailored to your specific fitness level and a health care professional should be consulted before beginning any recovery program.
https://www.youtube.com/watch?v=UBfvh_Q_mxc&t=16s