This is really different for men and women, and varies enormously between regions or countries. If it is just meant to describe a base-layer around the private parts then in England for example some higher up men wore braies or then 'trouses', whereas most would use an extra long shirt that "wrapped around" for that purpose.
In the late middle ages or early renaissance Italian noble women had the fancy idea of wearing underpants and Caterina de’ Medici (1519–1589) is commenly seen as the first woman to introduce this style into courtly France.
But until around 1800 generally a woman would not wear these. This changed for the upper classes up around 1840, when upper class women had to have it, while lower classes still went commando.
Modern looking briefs or panties were introduced to Germany in 1914.
And in the "modern sense" means really as well "changed daily". Instead of weekly or even less frequent, by the vast majority of people. That brings in some other prerequisites: cheap availability and washing machines, delaying the use of underpants in the modern sense well into the 20th century.
And a story my grandmother used to tell: "Those disgusting peasants! When I was young they didn't wear any underpants. And never changed their trousers either, since they usually only had one! And those they didn't wash, wearing them daily except for Sunday church and when they showed too much sign of wear and tear after years they would bury them in a field. Made apparently good fertiliser by then!"
The above I took with some salt.
Source: Cecil Willett & Phillis Cunnington: "The History of Underclothes", Dover: New York, 1992 (1951).
Caroline Cox: "History of Panties" gives some indications for "why":
Underpants or drawers, known colloquially as "panties," were first worn during the Renaissance for function but were also used as a chastity device. They were described at the time as "helping women keep clean and protecting them from the cold, they prevent the thighs being seen if they fall off a horse. These drawers also protect them against adventurous young men, because if they slip their hands under their skirts they can't touch their skin at all" (Saint-Laurent, p. 65).[…]
By 1841, however, The Handbook of the Toilet suggested that French drawers were "of incalculable advantage to women, preventing many of the disorders and indispositions to which … females are subject. The drawers may be of flannel, calico, or cotton, and should reach as far down the leg as possible without their being seen" (Carter, p. 46).
Caroline Cox: "Lingerie: A Lexicon of Style", London: Scriptum Editions, 2001.
Jennifer Craik: "The Face of Fashion: Cultural Studies in Fashion", London: Routledge, 1994.
In the beginning, there was the loincloth. Well, 7,000 years ago there was, as the remains of leather loincloths have been found by archaeologists. Resembling a nappy, the basic style was a long strip of fabric that prehistoric man passed between his legs and tied around the waist.
King Tut was buried with dozens of fine linen loincloths cut in a natty alternative style – a triangle of fabric with strings on the longer ends. The garment was tied round the hips with the material hanging down the back, and it was then pulled through the legs and tied. The Ancient Greeks had loincloths, although there is speculation that only slaves wore them; citizens went commando under their chitons.
Once the Romans came along, choices began to diversify. Their subligaculum could take the form of shorts or a wrapped loincloth. By the 13th century, loose pull-on underpants were invented. Called "braies", these baggy, calf-length drawers, often made from linen, were worn by peasants and kings. Knights wore them underneath their armour. Richer men also wore "chausses", which only covered the legs.
Come the Renaissance, as the chausses became tight hose, the braies got shorter and were fitted with a convenient flap for urinating through. That buttoned or tied flap – the earliest codpiece – wasn't actually covered by outer layers, so Henry VIII, never one for modesty, began to pad his. Historians have suggested that beneath Henry's appendage may have been hidden the medication-soaked bandages needed to relieve the symptoms of his syphilis. Men free of venereal disease, meanwhile, used the tumescent codpieces as a handy pocket. ("New World cigarette?" "Ah, not for me, my lord, no.")
The cocksure Tudor pants were followed by several centuries of more demure smalls, with men opting for long cotton, silk or linen drawers. The most common were knee-length with a simple button flap at the front. They were the precursors of the "union suit", an all-in-one that would evolve into long johns, the ankle-length skin-tight underpants issued to US soldiers in the Second World War (and named after the 19th-century boxer John L Sullivan, who wore them in the ring).
After the Industrial Revolution, cotton fabrics democratised pants. The invention of the bicycle spurred the development of the jockstrap, first crafted in 1874 by the Chicago sporting goods company Sharp & Smith to provide protection for cycle "jockeys" on cobblestone streets.
"A Brief History Of Pants: Why Men's Smalls Have Always Been A Subject Of Concern", Independent, 22 January 2008.