means that
a minor breach of a rule may be overlooked when it causes no harm or unfair advantage. The saying does not establish that every harmless-looking violation is acceptable.
Imagine a case where a breach of some code or law may have occurred but no damage has been done, so no punishment, apology or retribution is required.; then “No harm, no foul” fits well.