c. 1300, "action of guarding or shielding from attack or injury; act of defending by fighting; a fortified place of refuge," from Old French defense, from Latin defensus, past participle of defendere "ward off, protect" (see defend). It also arrived (without the final -e) from Old French defens, from Latin defensum "thing protected or forbidden," neuter past participle of defendere.
Middle English defens was assimilated into defense, but not before it inspired the alternative spelling defence, via the same tendency that produced hence (hennis), pence (penies), dunce (Duns). Webster made the -se form standard in U.S., but British has preferred defence, and compare fence (n.).
Meaning "a speech or writing intended to repel or disprove a charge or accusation" is from late 14c., as is the sense of "method adopted by one against whom a lawsuit has been brought." Meaning "science of defense against attack" (in fencing, boxing, etc.) is from c. 1600. Used by 1935 as a euphemism for "national military resources," but the notion (non-euphemistic) was in Middle English: man of defense "warrior," ship of defense "warship." Defenses "natural weapons of an animal" is by 1889. Defense mechanism in psychology is from 1913.