Unlike calcium, sodium and potassium hydroxides, magnesium hydroxide is highly insoluble in water, so you can precipitate magnesium and separate it from seawater by adding a strong base such as sodium hydroxide. Once you've isolated the magnesium hydroxide, you can re-dissolve it by adding hydrochloric acid. At this point, you will have isolated the magnesium in the form of a salt, magnesium chloride. While separating magnesium from seawater makes for a fun experiment, you should not try to eat the end product. Depending on how you carried out the experiment, it's always possible that impurities are present, so do not assume it's safe for consumption.
Start out by putting on the usual safety equipment -- eye protection, goggles and gloves.
Add 5 mL of seawater to your centrifuge tube, then add 5 mL of 5 molar sodium hydroxide. Be careful with the latter because it causes severe burns if it comes in contact with your eyes or skin. Stir the contents with your glass stirring rod to mix.
Cap your centrifuge tube. Fill another centrifuge tube with 10 mL of water (either seawater or plain water is fine) and cap this second centrifuge tube as well. Place the two tubes in the centrifuge opposite each other so they balance out.
Close the centrifuge and turn it on. Centrifuge the tubes for two minutes.
Allow the centrifuge to come to a stop, then remove both tubes. Take the tube containing the alkaline seawater solution and bring it back to your bench. You should see a precipitate of white salt at the bottom of your tube.
Carefully decant the water over the salt precipitate by pouring it into a beaker without dislodging the salt at the bottom of the tube.
Add a couple drops of hydrochloric acid to the salt in the beaker, then add two mL of deionized water. Stir with a clean stirring rod to dissolve the salt precipitate. It's possible not all of the salt may dissolve at this stage.
Test the pH by using the stirring rod to place a drop of water from the tube on a piece of pH paper. If the pH is still alkaline, add more hydrochloric acid one drop at a time and test the pH until it is close to neutral.
Pour the contents of the tube into the second small beaker. Rinse out the inside of the tube with 1 mL of deionized water and add this to the beaker.
Place the sand bath on the hot plate. Clamp a thermometer to a ring stand and position it so its tip protrudes beneath the surface of the sand.
Place the small beaker in the sand bath near the thermometer but not touching it. Heat the sand bath up until the temperature is a little over 100 degrees C and bring the water to a gentle boil.
Continue to boil off the water until you have only salt remaining. (This may take quite a while.) Do not continue to heat the salt once the water is gone.
The product you have contained might well contain impurities. Do not attempt to eat it or assume it is safe for human consumption.