The Swing Riots were a major headache for the powers that be in the 1830's. The farm labourers were on starvation wages and in the end some of them rioted, burning corn ricks, smashing up threshing machines and threatening the farmers that if they didn't pay up they would get a visit from 'Captain Swing'. In fact. Captain Swing didn't actually exist he was the labourer's version of the bogey man.
The song comes from the musical play 'The Tolpuddle Man' written by Graham Moore. It's sometimes performed by local singers in the courthouse at Dorchester where the Tolpuddle Martyrs were tried. If you ever get the chance, go and see it I can guarantee a very moving experience.