Bar-ends are mounted in the handlebar tube by friction alone. On any decently bumpy trail, they have a pretty good chance of twisting (forwards and down) and you could hit the handlebars with your face.
They are useful for one of the reasons curved bars are useful on a road bike, it's a change of position to give you a rest, and potentially a better climbing position but I doubt it.
I had bar ends on my bike in high school 'cause they were cool but I've ridden cross country and downhill MTB for a couple of decades now and bar-ends are not something I would consider adding to my bike.