I found this on a Facebook page of "Guns, Ammo and Blades" so it has to be true.

"Riding shotgun" refers to the practice of sitting alongside the driver in a moving vehicle. The expression "riding shotgun" was apparently not used in the days of actual stagecoach travel. At that time, the position next to the driver was said to be occupied by an "express messenger" or sometimes colloquially a "shotgun messenger". The phrase "riding shotgun" (not found before 1905) was applied later to print and especially film depiction of stagecoaches and wagons in the Old West in danger of being robbed or attacked by bandits. A special armed employee of the express service using the stage for transportation of bullion or cash would sit beside the driver, carrying a short shotgun (or alternatively a rifle), to provide an armed response in case of threat to the cargo, which was usually a strongbox. Absence of an armed person in that position often signaled that the stage was not carrying a strongbox, but only passengers. More recently, the term has been applied to a game, typically played by groups of friends to determine who rides beside the driver in a car. Typically, this involves claiming the right to ride shotgun by calling out 'shotgun' first. There may be other rules involved in the game, such as a requirement that the vehicle be in sight. The phrase has been used to mean giving actual or figurative support or aid to someone in a situation or project, i.e. to "watch their back".