By heating and agitating water while adding sugar, a saturated liquid is formed. As the syrup cools and evaporates, the fluid becomes super saturated - meaning the water has more sugar than it can hold. When this happens, sugar looks for a place to escape - these places are called nucleation sites and sometimes called "seeds."
The string provides the nucleation sites for crystal growth. As the water evaporates, more sugar crystallizes on the string - growing the rock candy.