I have an AT&T (GSM) iPhone 4. If I were to upgrade to an iPhone 5, could I simply pop the SIM out of my iPhone 4 and continue using it on wifi only?
Would I also need to get the SIM deactivated since an iPhone 5 would come with its own SIM?
Yes, you can use the device as if it were an iPod Touch without cellular service. No need to remove the SIM. It will automatically be deactivated when your new phone is activated.
You can also purchase a prepaid SIM from a service using provider network to which the phone is attached if you'd like to use it as an emergency or burner phone. For example, h2o pre-paid SIMS work in locked AT&T phones.
Here are the steps to use either an iPhone or an iPad without cellular activity.
You do not need to remove or even deactivate your SIM, although since the iPhone 5 uses nano-SIMs that are not compatible with older devices, your carrier will issue you a new one and likely disable the old one.
Generally, it's better to have even a deactivated SIM in your phone as to avoid problems with activation should you ever restore or upgrade the firmware.
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?