Do similar figure of speech exist in German or should one translate it literally?
One aspect I would translate as "Glück im Unglück" (lit. fortune in misfortune). Something bad (Unglück) has happened, but, contrary to expectation, without serious consequences (Glück).
If the unfortunate action was deliberate, like a breach of a law or a rule, Em14's translation of "Wo kein Kläger, da kein Richter" is the best fit.
As far as I understand the English expression "no harm, no foul" it is used colloquial rather than in standard English (but I am not a native English speaker). Then a frequently used colloquial analogue in German would be
"Ach was, ist doch nichts passiert."
In this expression the interjection "Ach was" makes the accident light, and also implies an apology. The second part "...ist doch nichts passiert" corresponds to "no harm".
Often we only hear the short form
The German expression "Wo kein Kläger, da kein Richter," literally means, "Where there is no plaintiff, there is no judge," and is probably the closest. In the German idiom, the emphasis is on the PERSONS doing the complaining or judging, as opposed to whether the ACTS can be complained about (harm) or judged (foul)
No, there is no similar figure of speach in German. Even the rule in soccer that comes closest to the meaning of the basket ball rule has no good name in German: the name "Vorteil" (advantage) misses the point (because we lack a better word, I assume).