We're now nearly nine years into the current bull market, and many experts are calling for a stock market correction, recession, or even a crash in 2018. While nobody has a crystal ball that can predict this with certainty, now could be a smart time to play a little defense.

With that in mind, here are three smart stocks to buy for both good times and bad. All three have the potential to generate strong long-term returns, and should weather any stock market storm better than most.

Man looking at stock market charts with hands on head.

Image source: Getty Images.

A retailer that works in any environment

Many investors are hesitant to add any brick-and-mortar retailers to their portfolio, and it's easy to see why. There were more than 20 major retail bankruptcies in 2017, and many others are struggling to stay afloat. And if retailers are struggling so much during one of the best bull markets ever, who knows what could happen during a correction or crash?

However, not all retailers are in the same boat. In fact, retailers with a discount or non-discretionary focus are doing just fine, and Wal-Mart (NYSE:WMT) fits into both of these categories.

As for a good stock during a bad market, consider that Wal-Mart's business model actually allows it to thrive during the tough times. Simply put, Wal-Mart has its loyal customer base, and when people who usually shop higher-end retailers need to cut back, they'll turn to discounters like Wal-Mart.

The proof is in the performance. In 2008, when many retailers saw sales plummet, Wal-Mart's went up. As far as investors go, while the S&P 500 plunged by more than 38%, Wal-Mart's stock price gained 18%.

WMT Chart

WMT data by YCharts.

Not only does Wal-Mart tend to do just fine during recessions, but the company also doesn't seem to consider e-commerce headwinds to be much of a threat. In fact, Wal-Mart seems to be one of the only retailers willing to compete with Amazon.com head-on, and the results have been quite impressive so far, with 50% year-over-year e-commerce growth as of the most recent data.

Defensive real estate

Certain types of commercial real estate typically perform terribly during recessions -- hotels are a good example. Others tend to do well no matter what the market is doing, and healthcare is perhaps the best example of recession-resistant real estate.

I like to stick with healthcare properties dependent on stable private-pay revenue sources, as opposed to government reimbursements like Medicare and Medicaid. HCP (NYSE:HCP) is one of the largest healthcare-focused REITs and its properties derive 96% of their income from private-pay sources.

The company has about 800 properties in its portfolio, most of which are senior housing, life science, or medical office facilities, and has taken steps over the past couple of years to improve its balance sheet, get rid of its riskiest assets, and reduce its dependence on its largest tenants.

HCP also has favorable demographic tailwinds, as the senior citizen population in the United States is expected to rise rapidly over the next few decades, which should produce a steady rise in demand for the company's key property types. HCP also pays a 5.7% dividend yield as of this writing, making it an excellent combination of income, downside protection, and long-term growth potential.

Bet on high-dividend stocks in tough times

As a general rule of thumb, well-established companies that pay above-average dividends tend to outperform the market during difficult times. If you notice, both stocks I've discussed fit this description.

Mature dividend payers tend to be consistently profitable companies, whereas high-growth stocks tend to be more dependent on a strong economic climate. Plus, dividends also help to create a "price floor" for stocks during downturns -- in other words, if a stock that typically yields 3% falls so much that it now yields 5%, buyers often rush in and create upward pressure on the stock.

One smart way to play it, without relying too much on any individual stock, is with the Vanguard High Dividend Yield ETF (NYSEMKT:VYM). This ETF tracks an index of about 400 stocks with above-average dividend yields -- top holdings include Microsoft, Johnson & Johnson, ExxonMobil, and JPMorgan Chase. And its rock-bottom expense ratio of 0.08% means that fees won't take much of a bite out of your portfolio.

These are recession-resistant, not recession-proof

To be perfectly clear, I'm not saying that these stocks won't go down if a stock market correction or crash hits. For example, a general slowdown in consumer spending could certainly hurt Wal-Mart.

What I am saying is that these three stocks will be in a better position than most to weather the storm. And smart investors know that it's not just how your portfolio does during bull runs that matters -- it's even more important over the long run to do well during the tough times.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Teresa Kersten is an employee of LinkedIn and is a member of The Motley Fool's board of directors. LinkedIn is owned by Microsoft. Matthew Frankel owns shares of HCP. The Motley Fool owns shares of and recommends Amazon and Johnson & Johnson. The Motley Fool has a disclosure policy.