When I moved to Kabul four years ago, the Afghan capital was better known, among foreign visitors, for its parties than for its bombs. A surge in U.S. troops and foreign aid had fueled an expat lifestyle of heavy drinking and carousing. The wild behavior had mostly subsided by the time I arrived in 2013, but a handful of bars, restaurants and at least one brothel still catered to foreigners. Contractors, diplomats and aid workers—plus a few journalists and the occasional fortune-seeker—dined in garden restaurants, where forbidden wine was served in teacups. Some places even offered beer, at $10 a can.

That...