It is required for phones (at least in Europe and US) to allow emergency calls without requiring the user to unlock the phone or the SIM card. You can always make an emergency call when you're in a cell coverage area and the phone has power. It's a safety feature, which guarantees you can use any phone in an emergency to get assistance, regardless of the state the phone is in.
Take this scenario: you're in a car crash and your own phone breaks. An unconscious friend's cell phone is working, but it has a pattern/PIN/password lock on it, or it lost power but boots to the SIM PIN screen. The feature guarantees that you can make the call without knowledge of the correct pattern/PIN/password.
The numbers you can call with this feature are restricted to the most common or regional emergency numbers, and are translated by the carrier to the local emergency numbers if you're roaming.
The exception to this are WiFi-only tablets, which can't make calls at all.
If the device's SIM is locked, it detects the networks available and identifies it's own network, but doesn't register the device to the network. In the case of emergency calls, the phone doesn't need to be registered to the network, all calls to emergency numbers are allowed, regardless of the state of the SIM or carrier subscription. Even with no SIM at all, the networks are detected and the carrier with the strongest signal is used.