means that
mistakes and mishaps can occur despite careful organisation and good intentions.
It is used
To console someone who has done a mistake.
When no matter how carefull we are, things will go sometimes wrong, by accident or mistake., the saying “Accidents will happen, in the best regulated families” is appropriate.