Typically if you make a withdrawal from a 401(k) before the calendar year in which you reach 59.5 years of age, you owe an additional 10% tax (penalty) on the distribution (withdrawal).

However, there is something known as the "rule of 55". From IRS Publication 575

Additional exceptions for qualified retirement plans. The tax doesn’t apply to distributions that are:

  • From a qualified retirement plan (other than an IRA) after your separation from service in or after the year you reached age 55 (age 50 for qualified public safety employees) (see Separation from service , later),

Separation from service. In order to meet the requirements for the first exception in the list above, you must have separated from service in or after the year in which you reach age 55 (or age 50 for qualified public safety employees). You can’t separate from service before that year, wait until you are age 55 (or age 50 for qualified public safety employees), and take a distribution.
Qualified public safety employees.
If you are a qualified public safety employee, distributions made from a governmental retirement plan aren’t subject to the additional tax on early distributions. You are a qualified public safety employee if you provided police protection, firefighting services, or emergency medical services for a state or municipality, and you separated from service in or after the year you attained age 50.
For tax years beginning after December 31, 2015, the definition of qualified public safety employees is expanded to include the following:

  • Federal law enforcement officers,
  • Federal customs and border protection officers,
  • Federal firefighters,
  • Air traffic controllers,
  • Nuclear materials couriers,
  • Members of the United States Capitol Police,
  • Members of the Supreme Court Police, and
  • Diplomatic security special agents of the United States Department of State.

This only applies to 401(k) or 403(b) money. You cannot rollover your 401(k) to an IRA and use this provision.

If You Plan on Using the Rule of 55, Roll In your IRA First

To the best of my knowledge there is nothing preventing you from effectively accessing your IRA money early by rolling over your IRA money into your 401(k) before you quit to take advantage of the rule of 55 (or 50 for public safety employees) (so long as your 401(k) accepts incoming IRA rollovers in the first place).

If you retire before 55 but find yourself wanting to access your IRA money at 55 without penalty, you could use this to your advantage. Find a job that offers a 401(k) that accepts incoming IRA rollovers (I know Starbucks offers even part time employees 401(k)s), rollover your IRA money into the 401(k), and then quit.