1560s, "a law or decree," from Latin sanctionem (nominative sanctio) "act of decreeing or ordaining," also "a decree, an ordinance, a law," noun of action from past-participle stem of sancire "to decree, confirm, ratify, make sacred" (see saint (n.)).
Originally especially of ecclesiastical decrees. The extended sense of "express authoritative permission" is by 1720, hence the looser sense of "the conferring of authority upon (an opinion, practice or sentiment); confirmation of support derived from public approval" (1738). Moral sanction, in Bentham's philosophy, is "the knowledge of how one's neighbors will take a given act, as a motive for doing or not doing it" [Century Dictionary].
As "a penalty enacted according to a provision in a law to enforce obedience to it" from 1630s; in later 17c. also "a provision of a law which enforces obedience through rewards or penalties." Hence the modern sense of "economic or quasi-military action by a state against another," usually to enforce terms of a law or treaty that has been violated (1919).
1778, "confirm by sanction, make valid or binding;" by 1797 as "to permit authoritatively," also in a general sense, "give countenance or support to, approve;" from sanction (n.). Seemingly contradictory meaning "impose a penalty on" is from 1956 but is rooted in an old legalistic sense of the noun. Related: Sanctioned; sanctioning.