A Mind Flayer hits its target with an attack using its tentacles. The target, a barbarian, becomes grappled, and also fails the Int save and becomes stunned:
Tentacles. Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 15 (2d10 + 4) psychic damage. If the target is Medium or smaller, it is grappled (escape DC 15) and must succeed on a DC 15 Intelligence saving throw or be stunned until this grapple ends.
Then, on its next turn, the mind flayer can use the Extract Brain action on the barbarian:
Extract Brain. Melee Weapon Attack: +7 to hit, reach 5 ft., one incapacitated humanoid grappled by the mind flayer. Hit: The target takes 55 (10d10) piercing damage. If this damage reduces the target to 0 hit points, the mind flayer kills the target by extracting and devouring its brain.
Can the barbarian do anything on his turn to break the grapple before this happens?
The stunned condition makes the creature incapacitated, which means they can't take actions (escaping a grapple is an action). Also, Stunned means they automatically fail Str/Dex saves.
Is the barbarian stuck? What kind of action could another character do to break this? I had another player character cast polymorph, but the Mind Flayer's Magic Resistance trait prevented it from working. If the MF gets another turn in combat, our Barbarian is likely dead, permanently.
I'd like to know the options my players could take, even if they don't know themselves.
Your players have a lot of options.
From the Grappled condition:
So any method of inflicting the incapacitated condition on the mind flayer will end the grapple. Likewise, anything that gets the barbarian out of the mind flayer's reach will also end the grapple. There are far too many ways of achieving these to list here.
It's also worth mentioning that, since the Extract Brain ability requires the mind flayer to use an action, preventing the mind flayer from taking actions would also work. Most of the methods to do this would involve inflicting the incapacitated condition, and therefore end the grapple anyway. But as an alternative option, there's always mind control. There are a large number of spells that could be used to persuade the mind flayer not to extract the barbarian's brain, or just to let them go.
Since the mind flayer's grapple requires a Medium or smaller creature, polymorphing the barbarian into something Large should also free him. There is a minor point of ambiguity here - while the grapple can only be used on a Medium or smaller creature, it doesn't technically say anything about what happens if a grappled target becomes Large. But I think most DMs would agree that this should work.