Carnallite is an important source of potash, an invaluable fertilizer. Sylvite is the more important source of potash, but carnallite makes a significant contribution. Carnallite's magnesium output is of much lesser importance world wide but is still Russia's most significant source. Potassium is actually a common element, but unfortunately it is bound up in insoluble silicate minerals such as potassium feldspars. In order for potassium to be useful as a fertilizer it needs to be in a soluble form and thus soluble potassium salts are the source of choice.
These minerals are not that easy to form because evaporite minerals such as carnallite and sylvite as it turns out are some of the last minerals to evaporate from sea water. Minerals such as calcite, dolomite, gypsum, anhydrite and halite crystallize first in roughly that order. The conditions that must exist in order to have potassium and magnesium salts form involve having sea water contained in a cut off, but not completely isolated basin similar to the Black Sea. However the Black Sea does not form carnallite because it is not located in a warm enough climate as intensive evaporation is needed (this is an evaporite mineral after all). The basin must also not allow the concentrated brine to leave the basin so as to continually increase its salinity. The brine will sink to the bottom of the basin and allow fresher water to enter the basin which brings more magnesium into the basin. This has the effect of prolonging the crystallization of the salts and increasing the salinity of the brine. If evaporation does not progress this way, then the minerals listed above may fill the basin before the potassium salts have a chance to crystallize.
This scenario for potassium and magnesium salt formation is not observable today because current day basins such as the Black Sea, Hudson Bay, Persian Gulf, Red Sea, Baltic Sea or Sea of Japan have either the wrong shape or the wrong climatic conditions. But this was not always the situation in the geologic past as numerous ancient potassium and magnesium salt deposits have been found. Specifically the Permian, Devonian and Carboniferous time periods were excellent times for such basins and they are responsible for most of the worlds evaporite deposits. Most notable potassium and magnesium salt deposits are found in Carlsbad, New Mexico; the Paradox Basin in Colorado and Utah; deposits in Strassfurt, Germany; the Perm Basin, Russia and the Williston Basin in Saskatchewan, Canada.
Carnallite is relatively easy to distinguish from other evaporate minerals.