If you are an existing O2 customer you will keep your number, it will all be dealt with through iTunes.
From the O2 website:
"Existing Customers
You'll need to start a new 18 month minimum term contract and pay for your iPhone handset but you can keep your existing number. So everyone will know it's you when you call them to brag.
If you were an O2 customer or upgraded before 18 September 2007
You can switch to an O2 tariff for iPhone without paying any remaining monthly charges on your existing contract.
If you joined or upgraded after 18th of September 2007
You have a choice, you can either:
(i) Enter into a second pay monthly contract whilst keeping your existing contract; or
(ii) Start a new contract by paying a one-off transfer charge of £219 instead of the remaining monthly charges on your existing contract.
O2 Simplicity and O2 Pay & Go customers will not be required to pay any additional charges."