In the 17th century, the Scottish kilt wasn't the tailored garment we know today. Rather, it was a long piece of tartan that could be worn in a number of ways depending on the weather and activity, yet it was uniquely Scottish. When James II was deposed as the last Catholic king of England (he was King James VII in Scotland) in 1688, Jacobites from the Scottish Highlands fought to restore the Catholic Stuart line to the throne for decades- until the Battle of Culloden in 1746. Afterward, one of the punishments was a ban on kilts as a blow to Scottish identity.
The law worked … mostly. The tartan faded from everyday use, but its significance as a symbol of Scottish identity increased. During the ban, it became fashionable for resistors to wear kilts in protest. As Colonel David Stewart recounted in his 1822 book, many of them worked around the law by wearing non-plaid kilts. Some found another loophole, noting that the law never "specified on what part of the body the breeches were to be worn" and "often suspended [kilts] over their shoulders upon their sticks." Others sewed the center of their kilt between their thighs, creating a baggy trouser that must have resembled an olde tyme predecessor to Hammer pants.
Read about the kilt ban and its effects at Mental Floss.