Substances can conduct electricity if there is a way for charge to flow through that substance. For a substance to conduct electricity, it needs to contain some sort of charge carrier - this could be an electron or an ion - that is free to move within the substance.
When an ionic substance is molten or dissolved, the ions that make it up are free to move within the substance and carry charge through it, i.e. conduct electricity. However when an ionic compound is solid, it exists as a giant ionic lattice, where positively charged cations and negatively charged anions are held in a lattice by strong ionic bonds and are not free to move around. This means there is no possible movement of charge, so a solid ionic compound cannot conduct electricity.