When a fighter’s mouthpiece has come out, it would be safe to assume the action should be immediately stopped to prevent serious damage to an unprotected boxer. But obviously this would be open to abuse from a fighter who wanted a break, they could intentionally spit the guard out.
So the rules are made to protect the fighters and the integrity of the sport.
If the mouthpiece is dislodged during competition, the referee will call time and have it replaced at the first opportune moment without interfering with the immediate action. Points may be deducted by the referee if he feels the mouthpiece is being purposely spit out.
World Boxing Federation Rules
In the past the action would continue until the bell had rung, but this has been changed.
How Are Mouthpieces Made?
They can be bought off the shelf, but an ill-fitting mouthpiece can lead to a lot of damage to the mouth and teeth.

The best way is to have one custom made. For this, a dentist can make a mold of the boxer’s mouth. A rubbery plastic called Ethylene-vinyl acetate or EVA is then poured into the mold, which the fighter bites down on. Once it sets, it is filed down and cleaned, and is ready for use. Replacements are cheaper as the mold can be reused.
There are also kits that can be used to make mouthpieces without the need for a dentist.
Thanks to David Mark for the image.