Will an iPhone work with a SIM card?

If I bought an iPhone that was off contract and I got a SIM card, would it work?

It needs a micro SIM card.

Yes it will work unless it is locked version. Use a micro sim.

So long it's Micro size, then yeah it will.

It depends…

If the original carrier is the same as the SIM you are trying to use
or
If the phone is unlocked