Our goblin druid posed a question today which made our DM bluescreen:
"If I turned into a giant toad, swallowed a Medium-sized creature whole, and then turned back, what happens?"
The goblin druid is a Small creature, and the giant toad is a Large creature. The creature being swallowed is Medium-sized.
This is essentially the inverse of this question, though not quite a duplicate because it's the eating creature doing the shapeshifting rather than the eaten one. Closely related to this question, with the primary difference being wildshape by a willing druid vs polymorph of an unwilling monster.
Lack of specific rules means DM have to decide.
Despite lacking an appropriate excerpt from the books, we can at least refer to the designer's intent in a close situation, as expressed by Jeremy Crawford on Twitter (Courtesy of Rubiksmoose):
It is also worth noting that the latest official sage advice compendium encourages the use of "Rules As Fun":
So, let's try to anticipate the consequences of various adjudication options to keep the game fun, shall we?
If the creature is harmed, but the druid is not:
Whether you inflict massive damage, or just decide the creature disappears to nothingness - this means the Giant Frog becomes a killing machine. A level 4 moon druid probably does not need that kind of help.
If the druid is harmed, but the creature is not:
Then swallowing a creature becomes very risky. It removes the Giant Frog's main ability, and encourages the druid to stick to other combat forms. Bears and wolves. Yawn.
If both the druid, and the the creature are harmed (such as suggested here):
Then swallowing a creature becomes a valid, sacrificial move - that may have its narrative interest. However, the DM should ensure it can't be exploited too easily: killing a BBEG with that method only to have the druid back on his feet with a healing kit should feel like cheating.
If neither the druid, nor the the creature is harmed:
Game continues as usual, with many messy descriptions (if it is your thing) but few mechanical impacts.
Obviously there is plenty of nuances to be found between "harmed" and "unharmed", and every DM will choose whatever fits best. Option #4 seems the most safe and sensible option to me (I'd probably go for "both prone") - but #3 may lead to interesting situations if handled properly. This is only opinion though.
The more impactful the adjudication the DM has in mind, the more important it is that players be informed of the probable outcome beforehand (or that the characters be given an occasion to learn it through experiment). There are probably very few tables where the druid's bloody, unexpected death during a minor encounter would be welcomed as a "fun" surprise.