PVC pipes are strong and easy to cut, and once they are glued together, the joints are permanent. These are all desirable features for plumbers running water lines, but they also make PVC piping a useful material for making household furnishings. You can buy furniture-grade PVC pipes, but regular 1/2- or 3/4-inch plumbing pipes are more than adequate for bathroom shelving. You'll need furniture-grade fittings to assemble them, though.
Measure the height of the shelving you need and cut 4 lengths of 1/2- or 3/4-inch PVC pipe to that length with a hacksaw for the uprights. Mark the positions of the shelves on one of the uprights and cut the pipe on the marks. Use the pieces to mark and make identical cuts on the other three uprights.
De-burr the ends of the pipes with medium-grit sandpaper, then reassemble the 4 uprights by gluing them together with furniture-grade PVC 4-way side outlet tees. Install the tees one at a time, spreading PVC cement on the ends of the pipes and the insides of the parallel ends of the tee with the brush that comes with the cement. Seat each pipe fully in the tee before the glue dries. The outlets of all the tees that you install in one of the four uprights should be facing in exactly the same direction. An easy way to do this is to lay the tees flat on the ground with one outlet facing up when you glue in the pipes.
Glue a 3-way side outlet elbow to the top of each upright with the outlets facing in the same direction as the tees. Glue a PVC cap to the bottom.
Cut 4 shelf supports for each shelf from the same type of PVC pipe and de-burr the ends with sandpaper. Cut 2 long ones for the front and back of the shelves and 2 short ones for the sides. You can cut the pipes to any length as long as all the short ones and all the long ones are the same length.
Assemble one of the shelf sides by gluing the short pipes to facing pairs of outlets on the tees and elbows of two of the uprights. The unused outlets on both uprights should be facing in the same direction. Assemble the other side in the same way, but make sure the unused outlets are facing in the opposite direction to the ones on the side you just assembled.
Finish assembling the frame by gluing the long supports into the unused outlets in the tees and elbows.
Cut rectangles from a sheet of 1/2-inch plywood to form the shelves. Each rectangle should be wide and long enough to fit comfortably on the shelf supports. Sand the edges of the shelves, then place them on the frame.
Drill 1/4-inch holes around the perimeter of each shelf, spacing them about 6 inches apart. The hole should go through the wood and completely through the pipe underneath. Feed a 1/4-by 4-inch carriage bolt through each hole, slide a washer on the other end and screw on a nut. Tighten the nut with a wrench.
You can leave your shelves unfinished, coat the wood with a clear finish or paint it. You can also paint the pipes. Oil-based enamel will adhere better than latex. The shelves can be free-standing, or you can hang them on the wall by drilling through the rear uprights and attaching them to the studs behind the wall with screws.
Work quickly when gluing the pipes. Once you spread the glue, it stays workable for only about 30 seconds.