At various times the division of society into classes has had various levels of support in law. At one extreme we find old Indian classes - castes, which one could neither enter after birth, nor leave. (Though this applied only in relatively recent history.) On the other extreme there exist classes in modern Western societies which appear very fluid and have little support in law. When sociologistss speak of "class" they usually mean economically based classes in modern or near pre-modern society.
In Marxist terms a class is a group of people with a specific relationship to the means of production (social production). Marxists explain history in terms of a war of classes between those who control social production and those who produce social goods. In the Marxist view of capitalism this is a conflict between capitalists (bourgeoisie) and workers (proletariat).
Modern usage of the word "class" generally considers only the relative wealth of individuals or social groups, and not the ownership of the means of production.