"Sentence" has two meanings. A sentence can refer to a string of words with a subject and predicate. A sentence can also refer to punishment. The joke is centered on the word "sentence" and its different meanings in relation to marriage. 
To some - marriage is a word . . . to others - a sentence .