You can take money out of an IRA whenever you want, but be warned: if you're under age 59 ½, it could cost you. That's because the government wants to discourage you from raiding your IRA until you're retired. (It's a retirement account, after all.)
If you are under 59 ½: If you withdraw any money from a traditional IRA, you'll be slapped with a 10% penalty on the amount you withdraw. That's in addition to the regular income tax you'll owe on your withdrawal. Bad idea.
Roth IRAs offer a bit more flexibility. Generally, you may withdraw your contributions to a Roth penalty-free at any time for any reason, as long as you don't withdraw any earnings on your investments (as opposed to the amount you put in) or dollars converted from a traditional IRA before age 59 ½. In that case, you'll get hit with that same 10% penalty. Not sure which money is considered a contribution and which is considered earnings? The IRS views withdrawals from a Roth IRA in the following order: your contributions, money converted from traditional IRAs and then earnings. So if you take out more than you've contributed in total, then you're starting to dip into conversion dollars or earnings, and will be penalized and taxed accordingly.
If you're 59 ½ or older: You can usually make penalty-free withdrawals (known as "qualified distributions") from any IRA. But you'll still owe the income tax if it's a traditional IRA. To make qualified distributions from a Roth IRA, you must be at least 59½ and it must be at least five years since you first began contributing. And if you converted a regular IRA to a Roth IRA, you can't take out the money penalty-free until at least five years after the conversion.
Just to make it more confusing, there are several exceptions to these rules.