Whether you've just started investing or have been at it for decades, chances are the coronavirus pandemic has had an impact on your portfolio. The S&P 500 and Dow Jones Industrial Average both experienced one of the worst quarters in history earlier this year, and during that time, you may have watched your investments sink in value.

Market downturns are often good investment opportunities, though, because when stock prices are lower, you can get more for your money. Then, once the market starts to improve, you'll reap the rewards and watch your investments significantly increase in value.

However, although right now might be a good time to invest, that doesn't mean everyone should be throwing their money in the stock market. And there's one reason, in particular, why you might not want to invest right now.

Bear wearing a mask and seeing the stock market crash.

Image source: Getty Images

When you shouldn't invest in the stock market

For the most part, there's no wrong time to invest in the stock market. You'll want to start investing as early as possible (particularly as you're saving for retirement) because the longer you leave your money untouched in your account, the faster it will grow.

That said, it's crucial to make sure that you're not investing more than you can afford. And if you don't have a solid stash of emergency savings, it may not be the right time to invest in the stock market.

Once you begin investing, it's best to leave your money alone for as long as you can. If you're saving for retirement, this usually means you should avoid tapping your savings until you're ready to retire. If you withdraw money from your 401(k) or IRA before age 59-1/2, you could be slapped with a 10% penalty and income taxes on the amount you withdraw. The recently passed CARES Act temporarily loosened some of these restrictions, waiving the 10% penalty and allowing investors to pay income taxes over three years, but withdrawing your money before you should might still result in a hefty tax bill.

In addition, when you withdraw your money early, you're affecting its ability to grow over time. Compound interest allows your savings to grow exponentially the longer they sit untouched in your retirement fund, so by taking your money out too soon, you're limiting your long-term gains.

If you don't have an emergency fund but you're investing in the stock market, you run the risk of being forced to withdraw your money sooner than you should if you face an unexpected expense or lose your source of income.

Prioritizing your emergency fund

Ideally, you should aim to save enough in your emergency fund to cover at least three to six months' worth of general living expenses. Right now, however, it might be wise to try to save more than that if you can. Nobody knows how long the COVID-19 pandemic will last, so if you lose your job, there's no telling how long it might be before you're able to find another one. To be safe, you may want to stash a little extra cash in your emergency fund.

It's also important to consider where you want to park your savings. A high-yield savings account is perfect for an emergency fund because these accounts offer much higher interest rates than your standard bank savings account. Additionally, with a high-yield savings account, you can withdraw your money whenever you need it without paying a penalty.

Finally, keep in mind that you shouldn't postpone investing forever. Try to build a robust emergency fund as quickly as possible, so you don't lose much time to invest. You're more likely to see substantial investment gains if you're saving consistently and allowing your money to grow for decades; the sooner you can go back to investing, the better. Just be sure your emergency fund is solid first, so you don't risk having to pull your money out of the stock market later.