As of Friday, August 1st, it is now legal for US consumers to unlock their cellphones and take them to other carriers. Both the US Senate and the House of Representatives (in an ultra-rare bipartisan decision) signed off on the bill, and Friday was the day that President Obama signed it into law.
The White House commented on the bill signing, calling it a "triple win" - one for the American consumer, one for wireless competition, and the other for bipartisan congressional action. (Did you see any flying pigs this weekend?)
Here's a quote with a few more details,
What all this means is starting today, we now have the right to unlock our smartphones — or pay someone else to do it for us — without fear of prosecution from the law. To be fair, cellphone unlocking has only been illegal for a little over a year now, this was after a previous exemption to 1998′s Digital Millennium Copyright Act expired back in late 2012. With a fresh new exemption now in place, we are now free to unlock our cellphones until 2015, in which case the whole process starts all over again.
Keep in mind that while it’s legal to unlock your cellphone in order to take to other service providers, you’ll first need to make sure it’s been paid off with your current provider. After that, you can either unlock your own, or a used smartphone you bought from someone off of Craigslist. ~ Phandroid
Of course, you need to remember that not all carriers use the same radio technology, so you can't just take a Sprint phone and use it on AT&T. You will need to be cognizant of whether your device's radio is GSM or CDMA (or both) and plan accordingly.