Yabusame is a centuries-old Shinto ceremony to pray for peace in the land and rich harvests. The mounted archery is preceded by a Shinto prayer ceremony.
It originated with samurai who had to be skillful mounted archers in medieval battles before guns were introduced.