Bep managed to "escape" when the Nazis arrived - just like it is shown in this movie. There wasn't anyone watching, so Bep was able to slip right out - and she apparently just never was a person of interest for the Gestapo (unless any of those in hiding or Kraler or Kuglar indicated how deep into the whole scenario she was, it'd be easy for them to kinda hand-wave her away).
Miep simply got lucky - she happened to be from Vienna like the arresting officer (I'm not near my book, and I'm not attempting the spelling lol) so he just kinda decided to let her stay. But he warned her not to flee or he would come after her husband. Empty threat? Maybe, but Miep sure wasn't taking any chances. And the officer did stop by occasionally for the rest of the war.
Now, who knows what would've happened if Bep had stayed or Miep had been a native Dutch or from somewhere else. But that's history - certain things happen because of other things, and if other things had been different, certain things wouldn't happen the same way.