Both are correct with different meanings.
"Thanks, God" (with the comma) is a thank-you to God for something. A religious person may say it in a prayer to God, or a non-religious person may say it as a comment to themselves.
For example, it has been very dry and no rain for months. A religious person may go to Church and say this as a prayer or personal comment to God. A non-religious person may simply say it to himself at home without any true religious intent. It would be simply a 'thanks' to 'whoever'.
'Thank God', most often is used for showing your relief that something difficult (in some manner) is over.
Examples: "I had my exam this morning. Thank God, that's over !!". "I was on a diet for a month and was always hungry. Thank God the diet is over !".