The comma in German can be used in the following contexts:
Subordinate clauses have to have a comma separating the main clause (Hauptsatz) from the subordinate clause (Nebensatz).
Du hast mir gesagt, dass er krank war
You told me that you were sick
When the subordinate clause is embedded in the main clause, two commas are used:
Die Frau, die du gestern geküsst hast, ist verheiratet
The woman that you kissed yesterday is married
In infinitive subordinate clauses the placement of the comma is optional, it is used when the meaning without it is not clear.
Just like in English, commas are used to separate items when enumerating (listing) them:
der Obsthändler hat Bananen, Birnen, Melonen und Pfirsiche
The fruit seller has bananas, pears, melons and peaches
In countries where German is spoken, the comma is used as the decimal point:
1,2
Eins Komma zwei
One point two