The horseback idiom appears older than the wishes one by around 100 years. The older one seems to be based upon a Latin phrase from around 400 AD, with this particular translation by Robert Burton in The Anatomy of Melancholy of 1621.
If wishes were horses, beggars would ride
It's listed in a proverbs book from 1721:
Complete Collection of Scottish Proverbs - Page 178 - James Kelly - 1721
19. If Wishes were Horses, Beggars would ride.
Interestingly, the other horseback idiom also appears in this book, along with a Latin phrase:
110. Set a Beggar on Horse-back and he'll ride to the Dee'l.
Lat. Asperius nihil est humili cum surget in altum.
More on that later.
Set a beggar on horseback, and he'll gallop
The John Trapp of 1650 appears to be a valid truncation, as three years later we find the full proverb:
"The Fourth Book of Dr. Francis Rabelais" - The works of Mr. Francis Rabelais, doctor in physick - Volume 2 - Page 238 - François Rabelais, Navarre society, London - 1653
Fryar Jhon began to paw, neigh and whinny at the Snout's end, as one ready to leap, or at least to play the Ass, and to get up and ride tantivy to the Devil like a Beggar on Horseback.
(Tantivy means at full gallop.)
And earlier, in a list of proverbs:
"Certaine Prouerbes ... of the English Nation in former Times, and some of this present Age." - Remaines concerning Britaine: But especially England, and the Inhabitants Thereof - Page 272 - William Camden - 1629
Set a beggar a horseback,and he wil gallop.
And Wikiquote attributes it earlier, from 1621:
Set a beggar on horseback, and he will ride a gallop.
Robert Burton, The Anatomy of Melancholy (1621), Part II, Section III. Memb. 2.
Checking the source, we find a Latin phrase:
And though by their education such men may be better qualified, and more refined; yet there be many symptoms by which they may likely be descried, an affected fantastical carriage, a tailor-like spruceness, a peculiar garb in all their proceedings; choicer than ordinary in his diet, and as Hierome well describes such a one to his Nepotian; An upstart born in a base cottage, that scarce at first had coarse bread to fill his hungry guts, must now feed on kickshaws and made dishes, will have all variety of flesh and fish, the best oysters, &c. A beggar's brat will be commonly more scornful, imperious, insulting, insolent, than another man of his rank: Nothing so intolerable as a fortunate fool, as Tully found out long since out of his experience; Asperius nihil est humili cum surgit in altum, set a beggar on horseback, and he will ride a gallop, a gallop, &c.
Asperius nihil est humili cum surgit in altum
Here's a likewise English-Latin translation from 1672, and English-Latin-French-Italian from 1678.
Wiktiquote attributes this Latin to the Alexandrian poet Claudianus (c. 370 – 404):
Here's the full passage from In Eutropium:
Asperius nihil est humili cum surgit in altum:
cuncta ferit dum cuncta timet, desaevit in omnes
ut se posse putent, nec belua taetrior ulla
quam servi rabies in libera terga furentis;
agnoscit gemitus et poenae parcere nescit,
quam subiit, dominique memor, quem verberat, odit.
adde, quod eunuchus nulla pietate movetur
nec generi natisve cavet. clementia cunctis
in similes, animosque ligant consortia damni;
iste nec eunuchis placidus.
And translated:
Nothing is so cruel as a man raised from lowly station to prosperity; he strikes everything, for he fears everything; he vents his rage on all, that all may deem he has the power. No beast so fearful as the rage of a slave let loose on free-born backs; their groans are familiar to him, and he cannot be sparing of punishment that he himself has undergone; remembering his own master he hates the man he lashes. Being a eunuch also he is moved by no natural affection and has no care for family or children. All are moved to pity by those whose circumstances are like their own; similitude of ills is a close bond. Yet he is kind not even to eunuchs.
Best Answer
Is it -er, -ar, or -or?
The first thing to understand about historical variation in modern beggar versus older begger is that the history of writing ‑ar, ‑er, ‑or for English word-endings is rather complex and not a little muddled. It is unwise to look for perfect predictability here.
In answer to your question about why other words didn’t do that, it turns out that some did. Like beggar, liar too started off with ‑er, as did pedlar, and even today both peddler and pedlar continue to occur even though the ‑er form is the elder. Going the other way, Scots once had socerar for sorcerer, and you can still find people who write sorceror.
It should be no great surprise that there would have been broad historical variation in spelling these sorts of words, considering how all three of ‑er, ‑ar, ‑or as unstressed final syllables are and were pronounced identically by most speakers. Before spelling was regularized, whether a written word ended in -er, ‑ar, or ‑or was up to each individual writer’s preferences, and those in the north of the Isle of Britain often used ‑ar here where ‑er was more prevalent in the south. A lot of the northern ‑ar words later got reworked into ‑er words, but not all of them. And some, like begger, went the other way.
How that sorted itself out under regularized spelling, let alone readjusted spelling by those trying to toe a more Latinate line, did not always follow the same path for each word. The French also had some hand in this, since today’s friar is spelled that way because despite having been a frater in Latin, we got the word from frere in Old French (Modern French frère).
Although the normal agent-noun suffix in English is ‑er, English also has a number of agent-nouns that derive from Latin now have ‑ar there instead, such as bursar, scholar, vicar; vulgar and even cellar are also from Latin. But those only settled out that way due to spelling reform; most were originally ‑er words in English because of having come to us through the French, who had changed Latin -arius words into -(i)er words. Some of those instead ended up looking like solitaire in English.
Thanks in part to the invention of Old French which had only ‑(i)er there, many of these words were once spelled with ‑er before getting put “back into” ‑ar form under 17th-century spelling reforms. And some — like pedlar, liar, and beggar — seem to have been dragged along for the ride more by analogy rather by etymology.
While these ‑ar words that we got from Latin (with or without French intervention) are in theory distinct from native English words ending in ‑er and from Latin ‑or words (mostly agent-nouns like author, cantor, doctor, censor, cursor, elector, inventor, lictor), this distinction was not always well-preserved: notice how both sorcerer and sorceror occur, as do both imposter and impostor, with sorcerer and impostor now the more accepted or common renditions of those pairs. Plus even though ‑er was usually a native-English ending, Latin also contributed some ‑er words of its own to English, like neuter, integer, dexter, sinister, super.
Because of how 17th century orthographers wanted to make words look more like Latin when writing them, eventually some of our words that were normally ‑er even up north got reworked into ‑ar words instead, consciously or unconsciously tying them to ‑ar Latin forms whether real or imagined.
Examples already mentioned include liar and pedlar, but there are many more. A lot of words had their standardized spellings changed into unhistorical forms during this time, famously including ones like island and debt. In its article on English Spelling Reform, Wikipedia states:
As the last sentence cited above shows, mistakes were made during this time. And while it is arguable, beggar seems to have been one of these. The OED is not completely certain of this, as they say “probably imitating”. In particular, they say of beggar:
Which states:
The ‑ar1 case contains such words as altar, collar, pillar, solar, lunar, regular, similar, and so includes words that came to us both directly from Latin and via Norman French, and in English sometimes showed up as ‑(i)aire as in ordinaire and which are related to the ‑ar2 case.
The ‑ar2 case is words we refashioned from Old French ‑ier, but which ultimately have the same origin as ‑ar1 words. These include words like bursar, mortar, vicar. Many of these used to be ‑er words in English, but got redone in a “more Latin way” to turn them into their current ‑ar forms.
The histories behind ‑er and ‑or words in English are both of them even more complex than those of ‑ar are.