It may help to understand that in a GSM network, SIM (Subscriber Identity Module) card carrys your customer information and the "phone" is not a phone but a "terminal".
The original intent of the design was to make it easy to pop out your SIM card and pop it into another device and then you could use that device for whatever purpose. The original vision for this network was that you could have a phone in your home, another in your car, yet another in your office. When you moved between locations you would pull the SIM card out of whatever device you were using and pop it into the one where you were at and viola! You're communicating.
Also in the early days of GSM and PCS networks "phones" worked on only one radio frequency (850 and 1900Mhz in US and 900 and 1800Mhz in Europe as I recall). So a US customer traveling to the UK back in the early 80's could not use their "phone" but could easily bring their SIM card and pop it into a rented phone in the UK and the network would immediately recognized and authorized that person to use the network with the customer info on the SIM card.
In modern times, many phones (including the iPhone) are "multi-banded", with the iPhone being a quad-band and so there is no need to use different hardware when in most countries (not all however) overseas.
It's probably pretty rare to have to take the SIM card out at all these days. However as others have mentioned, if the terminal/phone is locked to a particular carrier, only that carrier's SIM card will work in the phone. This is a software lock meant to facilitate customer retention.
Better living through Marketing! 😉