Using Google Ngram Viewer (also with numerical style) it appears that people first started referring to the decades of the previous century like this in writing beginning in the early 20th century and the very end of the 19th century. If you go back and look at the context of these phrases when they're used earlier than that none of them seem to be in reference to decades.
A few examples: in a book published in 1896 the author writes, "as I remember it in the forties," obviously referring to the 1840s. Another book published in 1899 makes reference to "the beginning of the eighties" to refer to the 1880s. In 1903 there was a book published called In the Sixties which was about the United States in the 1860s. There are numerous other examples like this and by the beginning of the 20th century this decade-naming convention seems to have been completely standard.
So why did it start? I don't really know and maybe someone else can offer more information here. But I've read a lot of books written before the 20th century and when they refer to the past they seem to usually either cite the exact years or refer to it in reference to important events that were happening at the time like a kingship or war, rather than just "the thirties" or "the forties." It's not as if people weren't aware of dates or years before then, but maybe they were less aware (sometimes in old writing circa 17th century I've noticed people get dates wrong by a couple of years when recalling decades earlier even if they were major events) and maybe more generally they just saw less relevance in ascribing some specific culture or series of events as defining each decade rather than just referring to times in the past by specific important events that were actually happening at the time. Instead of saying you grew up in the 90s of the last century, if you lived in the 1700s you might say you "grew up in the reign of William III" and you were "born in the reign of King James II" or something like that or else you would just give specific years and locations.