The word lady is a polite term for a woman, specifically the female equivalent to, or spouse of, a Lord or gentleman, and in many contexts a term for any adult woman. Once relating specifically to women of high social class or status, over the last 300 years it has spread to embrace all adult women, though in some contexts may still be used to evoke a concept of "lady-like" standards of behaviour.
Formally, "lady" is the female counterpart to higher ranks in society, from gentlemen, through knights, to lords, and so on. During the Middle Ages, princesses or daughters of the blood royal were usually known by their first names with "The Lady" prefixed, e.g. The Lady Elizabeth; since Old English and Middle English did not have a female equivalent to princes or earls or other royals or nobles, aside from the queen, women of royal and noble status simply carried the title of "Lady".
As a title of nobility, the uses of "lady" in Britain are parallel to those of "lord". It is thus a less formal alternative to the full title giving the specific rank, of marchioness, countess, viscountess, or baroness, whether as the title of the husband's rank by right or courtesy, or as the lady's title in her own right.