In ionic compounds, cations (positively charged ions) are attracted to anions (negatively charged ions) due to the electrostatic force between them. This attraction is what holds the ionic compound together and gives it its characteristic properties.