"very thin sheet of metal," early 14c., foile, from Old French foil, fueill, fueille "leaf; foliage; sheet of paper; sheet of metal" (12c., Modern French fueille), from Latin folia, plural (mistaken for fem. singular) of folium "leaf" (from PIE root *bhel- (3) "to thrive, bloom").
The sense of "one who enhances another by contrast" (1580s) is from the practice of backing a gem with metal foil to make it shine more brilliantly. The meaning "light sword used in fencing" (1590s) could be from this sense, or from foil (v.). The sense of "metallic food wrap" is from 1897.