JAILBREAKING IS LEGAL!
As of July 2010, the act of jailbreaking and unlocking iPhones has been ruled by the U.S. government to belegal. According to the Electronic Frontier Foundation or EFF, "reverse engineering is a fair use when done for purposes of fostering interoperability with independently created software". So no, you won't get yourself in trouble with the law if you jailbreak your iPhone, iPad or iPod touch. But as stated earlier, Apple isn't exactly a fan of jailbreaking which explains why the company is so vocal with regards to opposing it. Apple may use technical countermeasures that will stop jailbreaking or prevent jailbroken devices from working but they will not be able to sue users over it. And as stated previously, your device warranty is void once it is found that has been jailbroken.