In my idiolect, the word "defense", with the emphasis on the first syllable means "the role of defending". With the emphasis on the second syllable, it means "the act of defending". A similar (though not quite as clean) distinction applies to the word "offense" which, with the emphasis on the first syllable, pertains to a role and, with the emphasis on the second syllable, pertains to an act. Is this phenomenon peculiar to these words, or does it apply more generally? Is there a formal name for such sets of words?
This has not been elevated to the status of a special term. There is some generality to the pattern and is discussed in the phonological literature. In English, verbs versus nouns have different stress patterns, having to do with whether final consonant clusters force final stress (in verbs) or not (in nouns). In addition, one can use nouns as verbs and vice versa. This give rise to pairs like perMIT (verb) vs. PERmit, transFER vs. TRANSfer, proTEST vs. PROtests, and the examples you noted. "Defense" and "offense" add a complication of being nouns derived from verbs by a consonant change.
This system is kind of chaotic, though, and I (and others monitoring my speech) find that I use perMIT for the noun, TRANSfer for the verb, maybe PROTest along with proTEST, but CONvict vs. conVICT are strictly "by the rules". The (fairly arcane) analysis of The sound pattern of English would give you DEfense and OFfense by a specialized layer of derivation, turning a noun into a noun.
Such words (and words which are generally spelled the same but pronounced differently) are known as heteronyms (or heterophones).