It refers to the English legal system. In some countries if you break the law, you automatically get taken to court - 'prosecuted'.
But in England there are lots of conflicting systems. The main two are the civil and the criminal law (that's a gross over-simplification, but it'll do

). If you commit a 'civil' offence - that is, broadly, one that doesn't interest the police - you can be taken to court - 'sued' - by another person. If you commit a crime, you're not always sued (although you may be if the victim thinks the police haven't taken the matter seriously enough).
Two examples: person A is robbed. The police arrest the thief - a homeless man. But person A takes pity on him (the man only stole the price of a pint of beer) and decides not to 'press charges' - the police don't prosecute.
Person B is stabbed. He knows who did it, but the police can't prove it, and after a few weeks they give up trying - again, they don't prosecute. But Person B is not satisfied and employs a private investigator to find evidence of the stabbing. The standard of proof in the two legal systems is different*. He takes the aggressor to court, for medical costs, legal fees, and loss of earnings (this is not
prosecution, because it's not a criminal court) and wins. The person who stabbed him doesn't go to prison, but he pays a civil penalty (often just money - but sometimes a large amount).
Sorry this is so long. As Pascal once wrote -
I apologize for the length of this letter. I didn't have time to make it shorter [maybe I've quoted that before - it's one of my favourites].
b
*
criminal court: 'innocent until proved guilty'... 'beyond a shadow of doubt'
civil court: 'balance of probabilities'
PS You may see signs in the UK saying 'KEEP OUT. Trespassers will be prosecuted'. People who put up such signs don't understand the law. A trespasser (civil miscreant) can't be prosecuted. Some sorts of trespass are defined as 'criminal trespass', but the land-owner doesn't have the power to prosecute. All he can do is press charges, which can't arise, since - by definition- criminal trespass is something that the police will prosecute over without asking the land-owner's opinion (although he may be 'called as a prosecution witness'). So what these signs mean is
KEEP OUT
Trespassers, if arrested for criminal trespass, will be prosecuted
or
KEEP OUT
Trespassers, if caught, will be sued
Not so pithy