I know some actors have lessons and practice but for some stuff they use doubles (don't know the right word)! Usually for show jumping or galloping in the beach and some dangerous scenes it's not them but really horseriders! Some movies are really well done and you can't tell the difference!
Emma Watson said this about her training when she had to learn to ride for the movie 'Queen of the Tearling':
“That was pretty intense. I had to not just sort of, like, walk around on it, I had to really, like, gallop. I had two months. They would normally say it would take six months to learn to be a confident horse rider so, you know, it was a quick process, but I actually really enjoyed it.”
You can read a lot of other anecdotes here 🙂: http://www.horseandhound.co.uk/features/emma-watson-and-5-others-actors-who-have-learnt-to-ride-for-films-513747#PCBkf7BrotdL2R1b.99
I read an article about Mario Luraschi who trains a lot of horses and actors.
He said that an actor who doesn't know how to ride can be quite good in a a small amount of time. They take lessons to be good enough for the scene they need to shoot, for example to have a credible position, to don't annoy the horse,...
But finally, it's the horse who is well trained, not the actor who is a good actor.
Some actors already know how to ride, so it makes things easier (it was the case for the main actors of The Lord of the Rings)
For some actors who are really not good enough to ride after lessons (it can happen), there's a mechanical horse and the camera uses techniques to make us believe that it's a real horse.