When do Germans say it? What is its origin?
"Das Wort zum Sonntag" is a weekly TV show. Every Saturday night, a priest (either protestant or catholic) gives a short sermon, often involving current affairs. It's one of the oldest shows in German TV, and although nowadays the audience is quite likely to be rather small (and mainly consists of older people), everybody knows it exists.
So by saying "Das war das Wort zum Sonntag", the speaker replies to a (probably sermon-like) monologue given by someone within a discussion, often sarcastically, by emulating a TV announcer giving the closing words to this particular show.
The show "Das Wort zum Sonntag" is shown on Saturday nights, after some entertainment show and a short news broadcast. It is followed by a movie or some other entertainment. So the phrase "Das war das Wort zum Sonntag" can also mean "The serious part is over, now the fun begins again".
Also, "Das Wort zum Sonntag" is pretty short, something like 3 to 5 minutes, but still incredibly boring for a lot of people. So many viewers always used this time to get new drinks from the fridge, or use the toilet. So the phrase "das war das Wort zum Sonntag" could mean "the boring show is over, it is now safe to return to your seat in front of the TV".