AT&T is already unlocking the iPhone 4, iPhone 4S and iPhone 3GS devices officially. Unlocking is performed to free the device from any network restrictions. After the device is successfully unlocked, one can use the SIM card of any carrier around the globe.
If you don’t know here is how we can get the official unlock from AT&T:
Step 1: Find the IMEI of your device by going to Settings -> General -> About. We can also get this IMEI number by typing the *#06# code on Phone.app.
Step 2: Now go to AT&T website, enter your credentials and visit Wireless Support Chat.
Step 3: Give them your IMEI number and wait for their email containing the instructions of unlock process.
Step 4: After you receive the email, connect your device with iTunes and backup/restore your device to get the official unlock on your device.
However, if your device is already jailbroken, you will lose the jailbreak once you update it to the latest firmware. But the method mentioned below will tell us how we can unlock our device while keeping the jailbreak preserved. Once you receive the confirmation email, perform the following steps before connecting your device with iTunes.
Step 1: Go to Cydia store on your jailbroken iPhone 4S device.
Step 2: Add the repo http://repo.bingner.com and download SAM.
Step 3: Go to Settings and open SAM.
Step 4: Click “De-activate iPhone” option.
Step 5: Now connect your device with iTunes which will get activated and the official unlock will apply.
Enjoy the officially unlocked and jailbroken iPhone 4S.
Update X1: Here is more concrete method which works on any iPhone running on iOS 5.0.1, 5.1 or 5.0 including all the basebands. This method doesn’t need any official unlock.