late 15c., originally nautical, "to fit (a ship) with necessary tackle, make (a ship) ready for sea," a word of obscure origin, probably from a Scandinavian source (compare Danish, Norwegian rigge "to equip," Swedish rigga "to rig, harness"), though these may be from English; perhaps ultimately from PIE *reig- "to bind."
The extended sense of "dress, fit out with, furnish with, provide" with something is by 1590s. That of "to adjust, put in condition for use, set in working order" is by 1620s.
The slang meaning "pre-arrange or tamper with results" is attested from 1938, perhaps a different word, from rig (n.) "a trick, swindle, scheme" (1775), earlier "sport, banter, ridicule" (1725), itself of unknown origin. Compare rig (n.2), which seems to approach some of these senses. To rig the market was a 19c. stock exchange phrase for "raise or lower prices artificially to one's private advantage." Also there is rig (v.) "ransack" from 1560s, likewise of unknown origin. Related: Rigged; rigging.