The government wants to discourage you from raiding your IRA until you're retired. (It's a retirement account, after all.)
If you withdraw money from a traditional IRA before you turn 59 ½, you must pay a 10% tax penalty (with a few exceptions). That’s on top of paying regular income taxes on that cash. The same 10% penalty applies if you withdraw investment earnings from a Roth IRA before 59 ½.
The exceptions involve cases in which you use the withdrawal to pay for college expenses, to buy your first home (up to $10,000) or for medical expenses greater than 7.5% of your AGI (adjusted gross income), or in case of disability.