I have lead packtrips in Yellowstone, Colorado and Wyoming wilderness and have ridden in both Grizzly and Black Bear country for the better part of the last 20 years. I have also spent the same amount of time on foot photographing both bears as well. I have encountered bears on the trail several times and luckily have not encountered a situation where we got between a sow and cubs...at least not on horseback.
Wildlife photographers have a saying..."only food runs". The big thing is to stay calm, stay put and try to enjoy the experience. It is most likely that the bear will take off at the sight of you but in case it doesn't I would recommend staying put or moving SLOWLY in the same direction you were going angling away from the bear. Give it an escape route and it will likely take it. If it feels as if you are pressing it or cornering it, the possibility is there it may charge and even if it is a bluff...you horse may not think so!
There are few instances where a bear attacked a group of people on food numbering four or more, even sows with cubs. Anytime we go into an area that is bear infested (certain lakes in the Yellowstone high country during cutthroat spawning season) we try to go in groups of four or more. Confronted by such overwhelming odds a bear will typically skedaddle as opposed to fight it out. The biggest risk you run in bear country is two fold...getting bucked off if your horse freaks at the sight of a bear and bears coming into camp, especially if you don't keep a clean camp.
The only caveat to the above is if you are unlucky enough to stumble really close to a bear on a kill. Then all bets are off. I would ride as steady and well trained a mount as possible that I know I can handle if things go south and keep my eyes and ears peeled. Being alert and staying in groups, especially in thick cover is your best defense. I could tell stories about all kinds of wildlife encounters both on horse and off after 20+ years as a wildlife photographer and hunting guide.