Fifty years ago, who could have foreseen how innovations like the internet or mobile phones would completely transform society and the economy? If someone did, they are probably very wealthy today. Looking ahead to the next 50 years, new and emerging technologies -- some we still haven't even envisioned yet -- will completely transform society in ways we can't even imagine.

At the same time, many of the top companies of today will still be around decades from now, creating products and services that still lead their respective industries, and churning out consistent growth for their shareholders. Here are two such companies that you should feel comfortable buying and holding for the next 50 years.

A highway with the year 2020 written between the yellow lines, followed by 2021, and so on.

Image source: Getty Images.

Visa: Full speed ahead on cashless trends

Visa (V -0.23%) is benefiting from an undeniable consumer evolution: Society has gradually been going cashless for years now, with the emergence of electronic payment platforms, online retailers, and digital banks. The COVID-19 pandemic has accelerated that shift. In 2019, e-commerce accounted for $3.5 trillion in sales worldwide, and in just 10 years, many countries will be almost entirely cashless, according to Global Data. Countries like Singapore, France, Sweden, and the Netherlands already count about 60% of their transactions as cashless right now, according to a study by Mastercard. The U.S. is not far behind at 45% cashless.

This is all good news for Visa. Visa is the market leader in the payment processing industry, which really only has a handful of major players, giving it a pretty wide competitive moat. Plus, Visa made a key strategic acquisition earlier this year when it bought Plaid, a fintech company that facilitates mobile payments through apps, like Venmo. This acquisition will expand Visa's market and enable it to gain a solid foothold in the growing mobile payments market.

Visa has been around since 1958, but it didn't go public until 2008. The stock is now trading around $200 per share. Over the last 10 years, through the Great Recession and the global pandemic, it has posted an annualized return of 26.6%. It is poised to take advantage of societal shifts and should continue to be a market leader for decades to come.

Walmart: Adapting and evolving as market leader

Fifty years ago, Sears was the largest retailer in the country and had been an innovator in many ways, including its adoption of the mail-order catalog. But then a new class of competitors came along, led by Walmart (WMT -0.08%), which carved out a niche as a discount retailer. By 1991, Walmart had become the biggest retailer in the world, surpassing Sears, which, after a 100-year run, continued its long, slow decline, culminating in a bankruptcy filing in 2018. Where Sears' decline stemmed from its failure to adapt in a changing landscape, Walmart has been able to adapt and thrive. 

Walmart has managed to remain the world's largest retailer despite the astounding growth of online retailer Amazon. Part of the reason why is that it has invested heavily to bulk up its online sales to compete with Amazon -- and those investments are starting to pay off. This year, Walmart has steadily gained market share with online sales and is now second to Amazon with about 5% of the online retail market. Amazon is well ahead with a 39% market share, but it has slowly lost some ground as Walmart has gained.

But Walmart is looking beyond online sales to other future trends. It has established an Intelligent Retail Lab on Long Island, New York, where it tests out new technologies, including artificial intelligence, designs, and processes to improve the customer experience for its stores of the future. While the future of retail is uncertain, Walmart has been remarkably stable in a shifting landscape and is positioned to continue to grow over the next few decades.