Elon Musk wears a lot of different hats. He's best known as the CEO of Tesla. Musk is the founder of SpaceX and The Boring Company as well as the co-founder of Neuralink. He owns Twitter, only recently stepping aside as CEO.

But there's one hat you probably didn't know Musk wears: real estate pundit. The multibillionaire recently made a dire prediction about home prices.

Musk's prediction

Venture capitalist David Sacks, who worked with Musk during the early days of PayPal, tweeted last week about the major problems facing the U.S. commercial real estate market. Musk responded with the following tweet:

Musk didn't elaborate on his comments at the time. However, he explained his views about the commercial real estate market in more detail in April during an interview with former Fox News host Tucker Carlson.

He told Carlson that the demand for office space is at a record low because of employees working from home. Musk didn't think the situation would improve but would instead worsen later in 2023.

Not everyone agrees with the Tesla CEO's take on home values. For example, the National Association of Realtors forecasts that housing prices will rise slightly this year. Musk's prediction could be too pessimistic because of an imbalance between housing supply and demand.  

Real estate's shining light

It remains to be seen whether or not Musk is right about the housing market. However, there's at least one shining light for real estate these days.

The demand for medical office space remains strong. Real estate brokerage Marcus & Millichap stated in its Office National Report for the second quarter of 2023 that medical offices don't face as many headwinds as other areas of real estate.

There's a good reason why this is the case. Despite the rise of telehealth, many patients want to visit their healthcare providers in person. And for quite a few conditions, in-person visits are a must.

This makes the medical office real estate market quite resilient. In addition, the aging demographics in the U.S. provide a strong tailwind for this market.

Stocks to consider

Medical office real estate could practically mint money for investors over the long term. One of the best ways to profit is to buy stocks of healthcare real estate investment trusts (REITs)

Welltower (WELL 1.10%) ranks as the biggest healthcare REIT.  It primarily owns senior housing and post-acute care facilities but also owns outpatient medical properties. Welltower offers a dividend yield of over 3.1%. And it's been a solid winner so far in 2023 with a gain of nearly 20%.

Ventas (VTR 1.20%) is the second-biggest healthcare REIT. Like Welltower, it owns senior housing and post-acute care properties as well as outpatient medical facilities. Ventas also has a major presence in the life sciences real estate market. While its shares haven't delivered big gains this year, income investors should love its dividend yield of nearly 4%.

If you're looking for more of a pure-play stock focused heavily on medical office buildings, Physicians Realty Trust (DOC) could be right up your alley. Roughly 97% of the REIT's net operating income is generated from leasing outpatient medical office buildings. Its share price is down a little year to date. However, investors are still making money thanks to Physicians Realty Trust's juicy dividend yield of over 6.4%.

To be sure, these healthcare REITs probably won't provide the jaw-dropping growth that some tech stocks could. But they could be great picks for anyone seeking to make steady income along with what should be solid growth prospects over the long run.