A coffin is a box that the deceased are put into before they are buried. "Coffin" sounds like "coughin". "Coughin" or "coughing" is a bodily action characterized by air expelling from the lungs and throat aggressively. This joke is playing on the phrase "coffin to death" because it sounds like "coughin' to death". 
I had such a bad cold , I thought I was coffin to death .