The outfit pajamas first appears in English as a loanword from Urdu, in a British newsletter about South Asia in 1800. In Urdu, it’s written پاجام (pājāma), or पाजामा (pājāmā) in Hindi, and has the same meaning. Those descend from Classical Persian پَاجَامَه (pājāma), meaning “pants”, through the Islamic Mughal Empire’s conquest of northern India. The Persian word comes from Persian roots پَا (pā), meaning “leg”; and جَامَه (jāma), meaning “clothing”. A much more prosiac origin than pants. Finally, pā descends from PIE ped-, meaning “foot”. Deep down, it’s all from the same root found in pedal, podium, or foot.
UK and Commonwealth English instead prefer the spelling pyjamas, based on the alternate Hindi spelling पैजामा (paijāmā), based on the alternate Persian spelling پَای (pāy). The British fashion of men using pajamas as nightwear is more recent, dating to 1870. Before that, the customary sleepwear was a nightshirt, or a nightgown for women. The abbreviation PJs is from 1930, while jammies is first seen in 1928. Pajama party as a subtype of slumber party is from the 1950s. Pajamas were briefly high fashion outerwear in the late 1960s and 1970s, but did not become common street clothes until their 2018 revival. The Australian children’s TV show “Bananas in Pyjamas” began airing in 1992.