I have to wonder if the cup wasn't really better for him though. He could hide up in there and still see out, and I'd imagine predators had never seen an octopus in a plastic cup before, whereas they are probably quite aware of shellfish.
Protect from what? It will certainly protect him from fish. I think it will work against anything without claws, and if he's up against something with claws, I think they would easily pry the shells apart too. Even against something with claws he could maybe crawl to the other side of the cup- they likely wouldn't open enough to crush the whole cup.