mid-14c., relien, "to gather, assemble" an army, followers, a host, etc. (transitive and intransitive), from Old French relier "assemble, put together; fasten, fasten again, attach, rally, oblige," from Latin religare "fasten, bind fast," from re-, here perhaps an intensive prefix (see re-), + ligare "to bind" (from PIE root *leig- "to tie, bind").
The older sense now are obsolete. The meaning "depend on with full trust and confidence, attach one's faith to" a person or thing is from 1570s, perhaps via the notion of "rally to, fall back on." Typically used with on, perhaps by influence of unrelated lie (v.2) "rest horizontally." Related: Relied; relying.
The verb rely, in the orig. sense 'fasten, fix, attach,' came to be used with a special reference to attaching one's faith or oneself to a person or thing (cf. 'to pin one's faith to a thing,' 'a man to tie to,' colloquial phrases containing the same figure); in this use it became, by omission of the object, in transitive, and, losing thus its etymological associations (the other use, 'bring together again, rally,' having also become obsolete), was sometimes regarded, and has been by some etymologists actually explained, as a barbarous compound of re- + E. lie (1) rest, .... But the pret. would then have been *relay, pp. *relain. [Century Dictionary]