Financial advisor Laurie Siebert cringed when an acquaintance said her husband, age 57, had just withdrawn $55,000 from his individual retirement account. He had previously set up the IRA with funds from a 401(k).
"He's going to hear from the [Internal Revenue Service]," said Siebert, a certified financial planner and senior vice president at Valley National Group. "If he had left the money in his 401(k) instead of rolling it into an IRA, he could have taken the distribution without paying a 10 percent penalty."
That's because federal law says if you leave the workforce in the calendar year you turn 55 or any time after that, you can take penalty-free retirement distributions from a 401(k)—but not from an IRA.
It's one of the ways you can tap retirement funds before age 59½. But advisors caution that, besides the complicated rules that differ from account to account, the loss of retirement-centric funds might not be worth the immediate cash.
Read MoreThe 4% rule is misunderstood
"I can think of only one scenario where I could support use of [retirement funds] for something other than retirement, and that is if you have been diagnosed with a terminal illness," said Ric Edelman, chairman and CEO of Edelman Financial Services.
"But if you plan on being around at age 65, 75 or 85," Edelman said, "you'd better leave that money alone."
Various data suggest that advice is eschewed by many workers. According to the IRS, Americans shelled out roughly $5.7 billion in early-withdrawal penalties in 2011, slightly down from $5.8 billion in 2010. This means that in those two years alone, workers shaved their retirement savings by more than $100 billion before they were supposed to.
Moreover, 21 percent of 401(k) participants had loans outstanding against their accounts at year-end 2011, according to the Employee Benefit Research Institute. Those outstanding loans, which involve no penalty or tax event but do come with certain stipulations, averaged 14 percent of the remaining account balances.
Read MoreForget that 4% withdrawal rule
As illustrated by those sheer numbers alone, sometimes life can get in the way of even the best retirement-planning intentions.
"Sometimes your 401(k) is the only place you can go for [money]," said Mary Ballin, a senior certified financial planner with Mosaic Financial Partners. "Say a spouse lost his job but you have house payments, children's education costs and things like that. You have to pay those bills."
But, Ballin added, "it shouldn't be your go-to choice."
If you've exhausted all other resources and feel like you absolutely must tap your retirement account early, make sure you understand your options.
Read More7 ways estate plans get derailed
For starters, you cannot take a loan from your IRA, but you can take loans from your 401(k) if your plan allows it. You're allowed to borrow up to $50,000 or half your vested balance, whichever is less, and pay it back with interest over five years.
This might seem appealing, because you are borrowing from yourself and paying yourself back. But it comes with potential problems.
You're likely pulling out thousands of dollars from the stock market and no longer will reap the benefits of a potential bull market and compounded interest. Additionally, you might be banned from making new contributions for six months (which some companies impose in that situation), and you will be using after-tax dollars to repay the loan, with interest.
Moreover, if you leave your job or are fired, the loan balance likely will be due immediately. If you fail to repay it, it will be treated as a distribution and subject to a 10 percent penalty plus regular income taxes. Additionally, your plan might charge a fee for allowing the loan in the first place.
Read MorePicking the right benefits plan
Rules for loans differ from plan to plan, so it's important to read your 401(k) plan documents before doing anything.
"Anytime you are thinking about tapping your retirement account early, be entirely sure you understand the rules that apply to your [situation], because not all retirement accounts are created equally," Siebert said.
Aside from a loan, there also are special exceptions that allow you to take a distribution without the 10 percent penalty. In addition to the one pertaining to Siebert's acquaintance, there is also something called a qualified domestic relations order, which can be used in a divorce.
Assume, for a minute, a common divorce situation: The husband has been working, but the wife has not. Upon divorce, assets are divided. Depending on what state you live in, that asset split could involve the wife getting the house and half of the husband's 401(k) savings.
Read MoreMarket's rigged? Get real
But she might find herself needing cash. That's possible through a Qualified Domestic Relations Order. It incurs a tax event, but not the 10 percent penalty.
Another exception falls under a 72(t), named for the provision allowing it in the Internal Revenue Code. This is a tricky one.
Basically, the provision allows you to withdraw substantially equal periodic payments from a 401(k) or IRA. This means that you take early distributions of predetermined amounts for five years or until you turn 59½.
The downside of this is that once you start taking these 72(t) distributions, you are locked into the preset amount and cannot change your mind.
Read MoreReady if the market tanks?
Some 401(k) plans also allow hardship withdrawals, defined by the IRS as "an immediate and heavy financial need." This means things like medical expenses, education expenses or avoiding foreclosure on your home.
Your plan will require proof that the hardship exists. And even if you do meet your plan's particular requirements for a hardship distribution, you will still pay a 10 percent penalty on top of regular income taxes.
But again, remember that although the law allows for ways to access retirement money early, it should never be viewed as a first choice.
"Only do it if there are no other choices," said Ballin. "It really needs to be the last-resort place to go."
CORRECTION: An earlier version gave an incorrect title for Ric Edelman.