The origin of this use is obscure; the allusion appears to be to commandos’ reputation for action, toughness, or resourcefulness rather than to any specific practice.

However, on Urban Dictionary (s.v. Going Commando), a former infantry soldier and medic gives a plausible explanation. He writes that, when on the field, soldiers sweat a lot and can’t take showers for days. Their uniforms are loose enough to allow for ease of movement, and they don’t wear underpants in order to prevent skin eruptions and fungal infections.

(A synonym of to go commando, the phrase to go regimental is said to refer to the Scottish infantry regiments, whose soldiers used to wear no underpants under their kilts.)

The phrase to go commando originated in U.S. university slang—apparently at the University of North Carolina. The earliest occurrence in the OED dates from 1974:

Current U.N.C. Slang (University of North Carolina, Chapel Hill) (typescript) Spring Go commando, to be without underwear.

The earliest instance of to go commando that I have found confirms that the phrase originated in university slang. It is from Marking the golden anniversary of a brief success, an article by Jim Spencer about the fiftieth anniversary of briefs, published in the Chicago Tribune (Chicago, Illinois) of Tuesday 22nd January 1985:

The women in the living room of the Kappa Kappa Gamma house at Northwestern University are all under 50. Yet only one prefers her man in briefs. Each spring these women gather with the brothers of Sigma Alpha Epsilon to celebrate “The Boxer Rebellion,” an evening of drunken revelry in which participants of both sexes wear boxer shorts.“Boxers leave more to the imagination,” Cathy Buss says.“Guys’ butts look better in boxers,” adds Kathleen James. “You don’t have that gnarly upper thigh look.”Furthermore, colored briefs are “sleazy” and going without underwear [“going commando,” as they say on campus] is simply gross.

Connie C. Eble, Professor of English at the University of North Carolina, recorded the phrase in:– College Slang 101: A definitive guide to words, phrases and meanings they don’t teach in English class (Spectacle Lane Press, 1989),– Slang & Sociability: In-Group Language among College Students (The University of North Carolina Press, 1996).

In the review of the latter book, the Rockford Register Star (Rockford, Illinois) of Thursday 18th April 1996 published this quiz:

The phrase gained currency in 1996 from its use by Joey (interpreted by Matt LeBlanc – born 1967) in an episode of the American television sitcom Friends (1994-2004). It was in fact widely thought to have been coined by the writers of that sitcom, as is clear from several articles published that year; the following for example is from the Reno Gazette-Journal (Reno, Nevada) of Saturday 26th October 1996:

‘Going commando’ gets airing on ‘Friends’

By Eric HenricksonGannett News Service

Is the United States “going commando”?The phrase, introduced by the character Joey on a recent episode of NBC’s hit show “Friends” is a euphemism for “Hey, I’m not wearing any underwear!”“Going commando” could stick with audiences and become part of the language, as “pooh-bah” did after the 1885 operetta “The Mikado” by Gilbert and Sullivan. Or it could rise to great heights of overuse only to crash and burn like so many “Saturday Night Live” catch phrases.“Popular culture is being relied upon to provide a group with an identity—language, styles,” says Jerry Herron, director of American studies at Wayne State University. “I think (‘going commando’) is exactly the same thing. You’re identifying yourself as a participant in a cultural position. . . . ‘Friends’ is trying to create the sensation that ‘Friends’ viewers are special.”The keys to the longevity of such a phrase are repetition and its context, Herron says. People must want to reuse the phrase because of the pleasant associations it will bring. Is it something worth repeating, or was it just funny once?If corporations pick up on it, he says, “once it’s in advertising, it enters the language.”Well, isn’t that special?

In 2002, to go commando was one of the 3,500 new words and phrases added to the Shorter Oxford English Dictionary. In an article published in the Casper Star-Tribune (Casper, Wyoming) of Monday 7th October 2002, Phil Kloer quoted Jesse Sheidlower, principal North-American editor of the Shorter OED, as specifying that the phrase predates Friends:

Once a word is added, Sheidlower says, the editors then trace its historical roots. Some TV viewers may have thought that the writers of “Friends” invented the expression “going commando,” to characterize a woman who ventures into public without underwear. “That definitely goes back several decades,” Sheidlower said.

The following editorial from the San Francisco Chronicle (San Francisco, California) of Wednesday 13th November 2002 criticised the Shorter Oxford English Dictionary for recording new words and phrases such as to go commando. The editorialist’s approach was prescriptive, as opposed to the descriptive approach adopted by the Shorter OED:

Pondering a New York Times account of how the Shorter Oxford English Dictionary has been updated from the version published in 1993, we’re aghast at the further contamination of what labels itself “The World’s Most Trusted Dictionary.”Apparently all one has to do to have a new word or expression enshrined in this two-volume edition of the revered work of lexicography is to script a soon-to-be-forgotten television series or mindless movie, or market a fashionable drug sure to be eclipsed before long by a scientifically superior product. Or you can coin a brash phrase for use in a sleazy business.The trouble with overly permissive dictionary revisions is that they saddle the next generation with thousands of references to everyday practices and items of popular culture that will be merely quaint – if they are remembered at all – a few years from now. Who will care in 2023 that the expression “go commando” meant going out without underwear on the TV series “Friends”? Dictionaries were invented for less frivolous duty, like pinning down the meaning of “is.”

In Navigating ’Net means learning new lingo: World Wide Web developing its own terminology, published in The Daily Ledger (Noblesville, Indiana) of Saturday 11th January 1997, Eric S. Miller mentioned a usage of the noun commando among Internet users:

Inexperienced Internet users may find some parts of the system intimidating. Rick Powell of Fishers was first intimidated by the technical jargon when he first logged on in 1994.Now he has found a favorite term—commando. A commando is a person who surfs the Internet without wearing underwear. It [is] part of Internet culture.