It turns out that it belongs to a group of nemertean worms that are active predators on crustaceans such as crabs. The original discovery of the group was made in Panama where a researcher studying the behavior of fiddler crabs repeatedly saw crabs suddenly freak out, making erratic motions. When he waded through the mud to get the crabs, they had been emptied- sucked dry. It turns out that a nemertean was lurking in the sand. When it detected the shadow of a crab passing overhead, it would harpoon it with a sharp stylet borne on its proboscis, enabling delivery of a dose of neurotoxin.
The worm secretes, through the same hole, digestive enzymes into the prey, rapidly liquifying the internal tissues. It then sucks out the resulting soup, leaving nothing but the exoskeleton sitting on the mud.
Now we know they are in Moorea. Crabs be warned!
-Seabird