Coffee goes stale mainly because the oils in the coffee (I am talking roasted coffee, whole beans or ground) react with oxygen in the air and go rancid, giving the coffee a stale taste. One way to prevent this is to seal the coffee away from air—this is why coffee in cans and some bags is vacuum packed. The second way is with cold, which slows down chemical reactions. Cold, freezer, duh!