Give it gas sacs
The Portuguese Man o' War is a colonial organism that superficially resembles a jellyfish. One of its component units forms a gas sac that allows it to float at the surface of the water. When it is in danger, the man o' war can deflate its sac to sink below the surface. It has no other means of propulsion.
Corals are also colonial organisms. Each polyp has a hard skeleton but inside is a soft animal. It is possible in theory for one polyp out of a certain number to develop into a large floating balloon, allowing the organism to move. It could use these to float and sink depending on conditions like weather and temperature. It may evolve like this in order to avoid large, slow-moving coral eaters that are bound to the sea floor, like giant starfish.
How would such an organism form a "floating reef"? I'm picturing a kind of branching and interlocking lattice, somewhat flat and with many "holes" that can be filled with the inflated polyps when the reef wants to float - like a giant sheet of bubble-wrap where the spaces in between the bubbles are hard coral. A person may be able to walk around on it provided they only step on the "hard" parts and avoid popping the balloons, and also avoid distressing the colony to the point where it would sink to escape.
However, the thickness of these "reefs" would be limited. Real corals grow huge because the living polyps grow on top of layers and layers of dead ones. But these floating corals cannot do this, otherwise there will be a certain point where the living balloon polyps can no longer lift the layers of skeletons they grow on. At some point the colony will have to break apart or shed their lower layers.