The verb rally is from French ralier, a combination of the prefix re- and alier, meaning "to unite." Dating to the late 1500s, in senses implying coming or bringing together or reassembling, it is older than the noun rally. In time, the verb came to be used to describe various forms of recovery, particularly physical and emotional ones.
The noun is first used in the 1600s as a word for the reuniting of forces, and it developed senses corresponding to the verb's thereafter. The financial rally debuts in the early 1800s and the sports in the latter half of the century. Their related verbs start being used around the same time.
While the market rallied on Thursday in anticipation of the historic stimulus bill that is expected to pass Congress, the coming recession could just as quickly send stocks spiraling again.
— Gabrielle Canon, USA Today, 26 Mar. 2020
In January, Arizona rallied back from a 44-24 deficit to stun Kansas 91-74 at Allen Fieldhouse.
— Justin Spears, The Arizona Daily Star, 29 Mar. 2020
As the examples illustrate, in finance, rally means "to rebound in price" (as a noun, "a recovery of price after a decline"). The prices on the rise again are those of securities and commodities. In sports, rally is used in reference to comebacks by a team or player who takes the lead after or recovers from a significant deficit during a contest especially by a renewed, sustained, or sudden offensive.
Another sports-related sense of rally is associated with play on the tennis court. Rally is the name for the act of practicing or warming up by exchanging shots with an opponent as well as for a series of shots interchanged between players before a point is won. The latter sense is served in the late 1800s. Earlier in that century, rally was used for an exchange of blows in boxing and that use may have influenced the tennis sense.
The Cyclone raged almost unchecked about the ring. In one lightning rally in the third he brought his right across squarely on to the Kid's jaw.
— P. G. Wodehouse, The Prince and Betty, 1912