This is when you are grateful for something. You may be alone, or you may be together with others, but you feel a need to express your gratitude, even out loud. You may be addressing God (who may, or may not be present), or you may be addressing nobody in particular. Indonesians might want to say syukur or alhamdullilah, or puji tuhan. In this case you would say Thank God (without ‘s’).
You can think of this as an instruction beginning with the imperative verb Thank.
You can also think of it as advice: You/We should all thank God!
If you are lucky enough to be face to face with God, and if God has helped you in some way, then you can also look God in the eye and say: Thanks, God. (with ‘s’ on ‘thank’) However, this is quite informal, and may not be an appropriate way to address someone as important as God. If you want to be more polite when addressing God directly, say: Thank you, God. (no ‘s’ on ‘thank’)