We don't have a modern-day Paul Revere riding a horse through the streets shouting that a recession is coming. But we don't need one, as there are plenty of economists, analysts, and even the Federal Reserve warning that a recession is likely in 2023.

But just because a recession may be on the way, investors don't have to abandon the stock market. Here's why three Motley Fool contributors think that AbbVie (ABBV -4.60%), Gilead Sciences (GILD 0.75%), and Johnson & Johnson (JNJ -0.26%) are relatively safe stocks to buy if a recession is declared this year.

Stay put through the transition 

Prosper Junior Bakiny (AbbVie): It may be hard to believe that AbbVie is a safe stock right now. The company's shares recently took a tumble following poor first-quarter results. AbbVie's revenue and earnings dropped during the period. But that's something investors surely expected -- the drugmaker lost U.S. patent exclusivity for its blockbuster rheumatoid arthritis medicine, Humira, this year.

AbbVie's period of declining revenue could last a couple of years. However, the pharmaceutical giant remains a safe stock to buy for several reasons. 

First, what AbbVie is going through isn't rare or unusual for drugmakers. Virtually every single pharma giant has had to deal with similar revenue-declining transition periods associated with patent cliffs at some point. The best remedy against that is the ability to develop new products to replace older ones, or in other words, a strong pipeline.

That brings us to our second point. AbbVie has already produced two key immunology products designed to replace Humira: Skyrizi and Rinvoq. These medicines' indications substantially overlap with Humira's. Management expects their collective peak annual revenue to surpass that of the company's former crown jewel by 2027. But with several dozen ongoing programs, AbbVie should be more than capable of adding more products to its portfolio over the years.

Last but not least, the drugmaker's ongoing revenue slump is unlikely to lead to it slashing its dividend either. AbbVie is a Dividend King, currently on its 51st consecutive year of payout increases (inherited in the years before 2013 from its parent company Abbott Laboratories). Management won't risk getting kicked out of this club. The company also offers a competitive dividend yield hovering around 4.1% and a conservative cash payout ratio of 43%, which leaves plenty more room for further dividend hikes.

A recession won't do much to disrupt AbbVie's prospects. Like other drugmakers, the company benefits from selling necessary goods that remain in demand even during downturns. And the regular payouts will help smooth out market losses in an economic meltdown. That's why AbbVie's stock is a buy in case a recession is on the way.

A rock-solid stock to buy and hold

David Jagielski (Gilead Sciences): Recession or not, Gilead Sciences is a business that's likely to perform well. The reason that seems probable is that the company focuses on areas of healthcare that require ongoing care, including oncology and HIV. Treatments for those illnesses don't stop because of what cycle the economy is in. And those are big areas of Gilead's operations.

They're also the areas of the company that are growing the fastest. For the first three months of 2023, it was oncology leading the way with 59% year-over-year revenue growth for Gilead Sciences. At $670 million in oncology-related revenue for the quarter, that still pales in comparison to the $4.2 billion that Gilead's HIV segment generated. But it's growing fast, and the company is putting more resources toward expanding its oncology business.

Earlier this month, the company announced that it acquired all the shares of XinThera, a privately held biotech company that focuses on developing treatments for cancer and immunological diseases. The transaction will help strengthen Gilead's pipeline in both oncology and inflammation. 

Gilead also has a potential catalyst in its HIV business, which generated sales growth of 13% last quarter. In 2022, the U.S. Food and Drug Administration approved a twice-yearly injectable, Sunlenca, which will give patients with hard-to-treat HIV another viable treatment option. At its peak, the drug could bring in $1.5 billion in annual revenue.

In addition to its top-growing business units being in oncology and HIV, which should provide Gilead with long-term stability, the stock also pays an attractive dividend yield of 3.8%. That level is well above the S&P 500 average of 1.7%. With consistent profits, some solid business units, and a high dividend yield, Gilead is one of the safer stocks investors can be holding heading into a potential recession this year.

A longtime safe haven  

Keith Speights (Johnson & Johnson): Investors have flocked to Johnson & Johnson as a safe haven during tumultuous times for decades. And for good reason.

The company is a healthcare giant with a market cap of over $400 billion. It's a Dividend King with 61 consecutive years of dividend increases. And perhaps most importantly, J&J's products typically enjoy strong demand even during economic downturns.

Johnson & Johnson no longer has household names such as Band-Aid and Listerine in its lineup. They now belong to the company's spinoff, KenVue.

However, J&J still markets pharmaceuticals and medical devices. Sales for the latter tend to hold up especially well during recessions for the simple reason that they're necessities for patients. 

Many investors like Johnson & Johnson's reputation, track record, and financial strength. If the economy deteriorates, these attributes will likely become even more appealing.