Thats a very good question, with two possible outcomes:

  1. If your contacts are saved to your phone then they should be safe during the transfer.
  2. 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.