If an event is rare, it doesn't happen often. If an object is rare, there aren't many of its kind. Obviously, finding a rare gem is a rare occasion.
Rare comes from the Latin word rarus, meaning “widely spaced,” as rare things are — whether in actual space or in time. You thought it was rare to meet someone you have so much in common with, until he fainted looking at the rare steak you ordered. The rare that describes prepared meat actually has a separate origin: it comes from the long-gone word rear, meaning “half-cooked.”