You can buy magic rocks from the Free Market, or farm them from certain monsters. Bubblings, Sand Dwarfs and Jr. Boogies are all listed as drops.
Buying is faster if you have mesos to spare; hunting the named monsters is the cheaper route if you would rather earn them.