Ionic compounds are formed by ions, atoms that have lost or gained electron/s. In case of sodium chloride (table salt), the ions are sodium and chloride. Here, sodium atom loses an electron to become a cation (Na+) and chlorine gains an electron to become anion (Cl-). There are no free electrons or free ions in a solid ionic compound. For electricity conduction, free electrons are required. Sodium chloride has a melting point of 801 degree Celsius and only at that temperature can these ions (Na+ and Cl-) be dissociated.
On the other hand, we can mix sodium chloride in water, which will result in dissociation of these ions and these free ions will be available for conducting electricity.
Thus, lack of free electrons (and ions) in case of solid ionic compounds prevents conduction of electricity.
hope this helps.