This is a very confusing phrase in British English. A public school is an exclusive school, only for people who can afford to go, with a few fortunate holders of scholarships. (This is called private education, and in most other English-speaking countries - notably the USA - these schools are called 'private schools'. Public schools in America are those provided by the community, to which all children are entitled to go, and for which no money is payable as fees. These schools are mostly called state schools in England.)
In Britain, the public schools are often very old, or are pretending to great age and tradition. The most famous, Eton College, was founded in the fifteenth century; St Peter's, in York, claims to have been founded in the eighth. They were originally charities by which poor but able boys could enter into careers, especially, in the days when the most important functions in government, administration and social organisation were held by priests, the Church. As the Church became less central to public life with the spread of literacy, and with the upheavals of the sixteenth and seventeenth centuries chiefly associated with the Reformation, these schools lost their charitable functions, and were adopted by the rich. In 1868, nine institutions (Charterhouse, Eton, Harrow , Merchant Taylors', Rugby, Shrewsbury, St Paul's School, Westminster and Winchester) were particularly recognized in the Public Schools Act which followed the Report of the Clarendon Commission in 1864. There are currently 243 members of the HMC, which represents independent schools in the UK.
The public schools have been at the heart of one particular strand of snobbery in Britain. The question heard from people concerned about social status and the upper classes «Which school were you at?» is designed to show which magic circle you belong to. No state school is likely to supply an answer that is found satisfactory to a real snob. This question is decreasingly heard nowadays; but the network known as the 'old school tie' is, I understand, still alive. (It refers to the fact that Old Boys of such establishments are entitled to wear a distinctive tie as a badge. Figuratively, it carries a suggestion of favour in such matters as appointments to jobs.) Within themselves, there are further strands of snobbery. I have heard discussions at great length over which are the 'big five' (perhaps Eton, Harrow, Winchester, Rugby and Charterhouse - but many would disagree); and there is a common sneer in the press that so-and-so went to «a minor public school». All the public schools have evolved in-group markers in the form of their own slang and traditions, and in terms of dress.
Girls' public schools began to be established during the nineteenth century. More and more schools have become co-educational during the last quarter of the twentieth century and the beginning of the twenty-first.