Charge for charge an inch of barrel over twenty four inches adds about ten feet per second to your velocity. Longer barrels can get more umph from bigger charges, but all and all not enough that Bambi or Bulwinkle would care.
We see the first guns rather short and well up until the seventeenth century barrels tended to be in less then thirty six inches.
the German hunting rifles were often thirty two or under, though some might be long.
About 1650-1700 the French Dutch and English began making barrels three and a half feet or more.
We are told they thought that it would mean higher power with the same or less powder, but ITHINK that was an explanation after the point.
I suspect with the advent of the bayonet it made sense to make a longer military gun, and civilian guns followed suit.
when German gun makes started to make rifles in America they made them in the style of German guns. Barrels around three feet.
However the buyers were English and Dutch and were already used to longer guns and so wanted a longer rifle. Soon three and a half up to four feet became common on rifles.
The longer sight radius make the easier to shoot well, but like velocity increases not so as you would notice.
By 1810-20 shorter guns started to become in style, in west Europe and America.
Boone and Kenton did well horse back with long guns, and in the southern Appalachian long barreled guns stayed in style past the First World War. I don’t THINK it has any thing to do with being more handy on a horse
If your new to the sport 42” might seem real long, but after you have had one and carried one 36” might start to look and feel like a carbine.
My first gun had a 32” and I thought it giant. Now those guns look like over grown pistols.