This occasionally happens with iPhone 4 or 4S. Usually it's fixed by turning the phone off and removing the SIM for ten seconds, then re-inserting the SIM before turning the phone back on.
To remove the SIM on an iPhone there's a tiny, circular hole on the right-hand side of the phone where you can push a thin object. The iPhone should've come with a tool specifically for this purpose, but anything thin enough will do. Apple themselves suggest a paperclip.