A caste was a familial rank in a social structure. In caste systems, such as those of Bajor and the Earth nation-state of India, one was born into a type of family and lived according to one's caste. Generally, one was prohibited from advancing one's caste in such systems. The caste system of Bajor was called D'jarra.
Caste-based discrimination was illegal in the Federation and was prohibited by the Federation Charter. (DS9: "Accession")
In the 22nd and 23rd century the Klingons had a warrior caste. One Klingon, Antaak, was disowned by his father for becoming a healer even though his house belonged to the warrior caste. (ENT: "Affliction", "Divergence"; DIS: "The Vulcan Hello")
The Torothan homeworld had a caste system under which the Torothan clan terrorized Zobral's clan for centuries, forcing them to wear a yrott, among other things. The caste system had officially been abolished for a number of years by 2152, but little had changed. (ENT: "Desert Crossing")
Troglytes and Stratos city-dwellers were the two castes on Ardana, divided by different levels of intellect. (TOS: "The Cloud Minders")
Aldean society was structured into "units", or social groups, which specialized in a particular art or pursuit. (TNG: "When The Bough Breaks")
Remans were considered an undesirable caste in the hierarchy of the Romulan Star Empire. (Star Trek Nemesis)