You can try turning the phone off, taking out the SIM card, putting it back in and turning the phone on. If opne of the contacts loses contact with the card, that fixes it.
If the SIM card is in properly, take it to the carrier. SIM cards do go bad (not very often, but they do), and the carrier will replace a bad one.
(I'm assuming you have an account with a carrier, and it's paid up.)