Crystallisation and crystal surface
The crystal structure of NaCl forms at the growing surface of the crystals, where there is plenty of time for the ions to sort themselves into a regular lattice. Further, each ionic species is very evenly distributed also in the solution, because of the repellent electrostatic forces between the members of each. Whenever there is a local excess of positive or negative charges, it will level itself out very quickly.

If you have something larger than sodium and chloride ions and try to crystallise very fast, you will indeed get an increasing amount of errors in the structure. Freeze-drying also tends to leave behind rather unordered structures. In both cases, this is, of course, more likely with noncharged or even nonpolar substances.