A kilt is a type of knee-length dress skirt found in Scottish culture. Kilt sounds like "killed". The joke is saying that you shouldn't make fun of a Scotman's traditional garb because you could get killed, but kilt was used in its place. 
Never make fun of a Scotsman ' s traditional garb . You could get kilt that way .