Can I use an old iPhone as a wifi-only device? I have an AT&amp;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&amp;T phones.