That's a very good question, with two possible outcomes:
- If your contacts are saved to your phone then they should be safe during the transfer.
- If your contacts are saved to your SIM, you will need to make sure you back them up as all the SIM data will be wiped.