This has happened to me a few times over the decades when jacking off.
It only happened once while having sex with my wife before we were married when in a position that required a good deal of strain. One slipped out and I laughed so hard I thought I was going to hyperventilate. Of course I was embarrassed, too, but it was just too damned funny