In Old French (and Italian), re- often appeared as ra- by confusion with the true ra- (from Latin re- + ad-), and the following consonant often was doubled; compare rabbet (a doublet of rebate), rappel (a doublet of repeal). But as ra- was not recognized in English as a prefix, words with ra- in Old French usually returned to re- in English; Rally and rabbet never were because the accent had receded. In later borrowings (rappel, rapprochement, etc.) the words tend to keep their French forms.
Intransitive meaning "pull together hastily, recover order, revive, rouse" is from 1660s. Related: Rallied; rallying. Rallying-point "place at or about which persons come together for action" is by 1798. Rally round the flag (1862) is a line from popular American Civil War song "Battle Cry of Freedom."
"make fun of, tease in a good-natured way, attack with raillery," 1660s, from French railler "to rail, reproach" (see rail (v.1)).
1650s, in military language, "a rapid regrouping for renewed action after a repulse," from rally (v.1). Sense of "a mass meeting to stir enthusiasm" is attested by 1840, American English. Sense of "gathering of automobile enthusiasts" is from 1932, from French rallye, itself from the English noun. Sports sense of "long series of hits from one side to the other" in tennis, etc., is from 1881, earlier "series of back-and-forth blows in a boxing match" (1825).