In solid state, ionic compound does not conduct electricity. It is because there is no freely moving ions in solid state. The negative ions and positive ions are strongly held together by electrostatic forces in a crystal lattice structure as shown below:
But, when ionic compound is heated up until its boiling point, the sufficient heat energy able to break up the strong electrostatic forces between positive ions and negative ions. This causes negative ions and positive ions to move freely in molten state. Thus, ionic compound can conduct electricity in molten state.
When ionic compound dissolves in water, the crystal lattice structure collapses and thus releases positive ions and negative ions. This causes negative ions and positive ions to move freely in aqueous state to conduct electricity.
Click on the diagram below to play!