At first I thought OP had just found a bad transcription. The copy I just picked up from Pennsylvania State University says a yearly, as you would expect (ditto gutenberg.org).
Thanks to @D Krueger for ferreting out Google Books scanned copy of the 1778 edition, which has an yearly.
A few centuries before Adam Smith, the indefinite article was always an. As Wikipedia says, 'an' and 'a' are modern forms of the Old English 'an', which in Anglian dialects was the number 'one'.
I can't say for sure if Adam Smith himself actually wrote an, or if it was a well-intentioned typesetter preparing the text of those early editions. At that time I suspect neither version would have been universally recognised as "correct", though there's no doubt a was far more common even then. Here's an NGram for an yearly showing a marked increase in frequency of occurrence starting around the time Smith's book was published, and petering out over the next few decades.
I think an yearly [income, etc.] would be likely to occur more often in legal texts, which are always more prone to archaicisms even today.
It's possible Smith or someone else involved in the printing process thought that using an archaic/legalese form added a touch of gravitas to the work.