A character provokes an opportunity attack when he moves out of a hostile creature reach:
You can make an opportunity attack when a hostile creature that you can see moves out of your reach. phb pg. 195, emphasys mine.
And this same character can avoid the OA if he teleports, or someone or something moves him without his action/movement/reaction.
You can avoid provoking an opportunity attack by taking the Disengage
action. You also don't provoke an opportunity attack when you teleport
or when someone or something moves you without using your movement,
action, or reaction. Ibidem
I would rule that, because shapeshift is an action, this action is the one that moves the character, and this action was made by the character, then the character can't avoid the OA.
Keep in mind that this OA happens just when the character use his shapeshift action to get outside the hostile creatures reach. He can move freely after that, the enemy already used his reaction.