The black sand at this exhibit is magnetite, a naturally occurring iron oxide mineral found in almost all igneous and metamorphic rocks.
The black sand we use at this exhibit comes from nearby Ocean Beach—but it originates in the Sierra Nevada Mountains to the east. There, granite containing iron ore breaks down into tiny grains of black sand that then erode, getting carried by rivers to San Francisco Bay and beyond.
Not usually magnetic in and of itself, black sand can and will become magnetized in the presence of another magnet. As each tiny grain of magnetized black sand becomes a (temporary) magnet itself, the magnetic field in that spot gets amplified, and more black sand gets attracted—ultimately creating the porcupine-like spikes that you see here.