In every case, notwithstanding anything discussed below, follow the storage instructions on the package of ham that you purchase. And use your common sense as well. If a ham was refrigerated when you bought it (whether it's canned or otherwise), it stands to reason that you'll need to refrigerate it when you get it home as well.
If you're interested, you'll likely want to read our discussion of how to prepare and serve the various kinds of hams described below.
What Is a Ham?
A ham is the back leg of a pig, and in the U.S., that means it's been brined and cooked. These hams will be labeled "ready to serve" or "ready to eat." This is as opposed to so-called "fresh" hams, which are unsalted and uncured and are basically just uncooked hog legs. Unless you're planning to cure and cook your own hog leg, fresh hams are not for you.
Fortunately it is nearly impossible to buy one by accident. Most hams in supermarkets are ready to eat, and they are available in both boneless and bone-in forms.
Selecting a Bone-In Ham
Bone-in hams are generally better, owing to the added moisture and flavor imparted from the bone (which happens to be the thigh bone along with part of the pelvic bone), as well as the fact that it is a whole leg of ham, versus scraps of ham that are molded together, which is the case for many boneless hams.
A bone-in ham will come either as a whole ham or a half ham. A whole will serve up to 20 people. A half ham will serve up to 10 people, and is available as the top or "butt" half, which is leaner and more tender, or the bottom or "shank" half, which is tougher and fattier, but more flavorful.
You can also find a semi-boneless ham which includes only the thigh bone but not the pelvic bone. These are easier to slice. If you're not confident in your slicing skills, a spiral-sliced ham is a convenient product, as most of the slicing is already done for you (and they heat up quicker).
Storing a Bone-In Ham
Bone-In hams need to be refrigerated, and you can store them in the fridge in their original packaging for up to a week. You can also freeze them for up to three months, albeit with the usual loss of quality that results from freezing.
Once opened, you can keep it in the fridge for up to three days before serving it, freezing it or tossing it. And remember to keep the bone for making ham stock.
Selecting a Boneless Ham
There are two types of boneless ham: foil-wrapped or plastic-wrapped boneless hams are oval-shaped sections of ham, often a quarter (either top or bottom, inside or outside of the thigh muscle) that have been removed from the bone. These are sometimes unsliced and sometimes spiral-sliced. If you're looking to serve a nice ham, either as a main course or for sandwiches or a cold-cut platter, this is a good choice.
The other kind of boneless hams are canned hams, which are not whole sections of muscle but rather are made from various smaller pieces of ham meat that are pressed together and molded into shape. Deli hams are usually this type of ham. If you're using your ham chopped up in some form, as an ingredient in another dish, this sort of ham should be fine.
Storing a Boneless Ham
Canned hams are shelf stable and can be kept in a cool cupboard or cellar for up to a year. In every other case, boneless hams need to be kept in the refrigerator, where they will keep for up to a week before you need to serve it or freeze it. They'll keep in the freezer for a month.
Note that you can keep a canned ham in the fridge, which will not necessarily extend its life, but might provide you with some peace of mind. Freezing a canned ham isn't necessary.
The last main type of ham, and they're less common, are so-called country hams, which are salt-cured and air-dried but not cooked. Country hams are meant to be stored at room temperature for up to two months (although the USDA recommends refrigerating them). This is probably not the kind of ham you're thinking of serving, but if you do purchase a country ham, you can freeze it for up to a month, again, with the expected quality loss.