Can you insert a Tmobile Sim Card into an iPhone 4S?

Can you insert a TMobile Sim card into an iPhone 4S and still have access to the app store and all the other stuff the phone provides?

If it takes a SIM card.

First, the phone has to be unlocked before you can use it on T-Mobile.
Second, you can access the app store and everything the phone provides.
Third, you'll have to use 2G (EDGE) as you won't get 3G on your phone.