As you guys know, the key idea in solubility is that “like dissolves like”. In other words, compounds with the same type of bonding tend to be soluble/miscible with one another. For instance iodine, a simple covalent molecule would be soluble in organic solvents like hexane (another simple covalent molecule).
However, why are ionic compounds soluble in water?
That is because water is a polar molecule. The positive end (H) of the water molecule is attracted to the anions on the surface of the solid ionic compound while the negative end (O) is attracted towards the cations, forming bonds with the anions and cations respectively. (Fancy A level term: ion-dipole interactions). See diagram below.
Bond formation results in the release of energy. This energy is transferred to the cations and anions making them vibrate faster eventually breaking the ionic bonds between the cations and anions causing them to break free from the ionic lattice and enter the solution! See diagram below. Note the ions breaking away from the lattice!
However, not all ionic compounds are soluble in water. This is because in certain cases, the energy released from the ion-dipole interactions is insufficient to break the strong ionic bonds between the cations and anions.
This explains why compounds like MgO are insoluble in water (energy released from ion-dipole interaction is insufficient to break the “double ionic bond” between Mg2+ and O2-).