Aquamarine often forms in pegmatites, which are coarse-grained igneous rocks. It crystallizes from beryllium-rich magma that cools slowly, allowing large crystals to develop.