It is your stateroom key and you also need to put it in a slot so that the electricity works. Some cruise lines like Princess have now developed technology so that you wear an Ocean Medallion instead of having a cruise card – more information can be found here.