What is the meaning of [never ask pardon before you are accused]

If nobody knows that you have done something wrong, do not apologize and reveal your guilt—you may get away with it