Middle English aforth, from Old English geforðian "to put forth, contribute; further, advance; carry out, accomplish," from ge- completive prefix (which in Middle English regularly reduces to a-; see a- (1)) + forðian "to further," from forð "forward, onward" (see forth).
The prefix shift to af- took place 16c. under mistaken belief that it was a Latin word in ad-; change of -th- to -d- took place late 16c. (and also transformed burthen, spither, murther, etc. into their modern forms).
The notion of "accomplish" (late Old English) gradually became "be able to bear the expense of, have enough money" to do something (late 14c.), and the original senses became obsolete. Of things, "be capable of yielding," 1580s, which is the sense in afford (one) an opportunity. Related: Afforded; affording.