The salt precipitates because sodium chloride is much less soluble in ethanol than it is in water. This happens because of the structure of ethanol, or
As a result, ethanol will react more with the water molecules than with the ions. This implies that fewer water molecules will be available to keep the aforementioned ions apart in solution
Less available water molecules to interact with the ions is equivalent to having an increase in the concentration of the ions in solution.
If the solution is saturated, this will automatically result in the precipitation of the salt.