There were few jobs less appealing in 19th century America than working on a merchant marine vessel. The work was demeaning, the food was inedible and the pay was minimal. Captains of merchant ships, especially those docked in ports along the Pacific coast, would sometimes resort to illicit recruiting methods in order to have a sufficient crew. Local thugs called "press gangs" would be hired to find suitable recruits in saloons, alleys, gambling dens and other places. Since many of the ships were bound for the Orient, this practice of involuntary servitude became known as a shanghai. To shanghai someone was to force him to "volunteer" his services under extreme duress. Organizers of these press gangs would often receive payment in the form of the unfortunate sea men's first month's salary.
Port cities such as Portland, Oregon and San Francisco, California became especially well-known for organized press gangs and the Shanghai surprise. Although there were several attempts to make the practice illegal, local politicians were often under the influence of the captains or the crime bosses who actually carried out the shanghai operations. One particularly successful crime boss actually threw himself a large birthday party in order to attract potential recruits. As the local men enjoyed free food and alcohol, a press gang would systematically shanghai those who passed out.
The American ship captains and crime bosses were not the first to use involuntary servitude, however. The British Navy faced the same labor shortage for their military operations, so every so often the officers would have a recruitment drive, meaning they could force any able-bodied man with any sailing experience into military service. Unlike the American practice of the Shanghai surprise, however, the British Navy did not accept men in questionable health or those lacking in sailing skills. American press gangs were often paid for each warm body they could shanghai, regardless of the victim's health, experience or moral turpitude.
Eventually, federal laws made the shanghai practice illegal, but by that time the need for involuntary seamen had virtually disappeared. Steam-powered ships reduced the size of most ships' crews, and captains of merchant ships could recruit experienced sailors without the need for violence. By the 1920s, the days of the Shanghai surprise were over.
In a modern sense, to shanghai someone means to compel him or her to "volunteer" for a project or errand. The element of involuntary service is the key to a good shanghai. A boss may assign a time-consuming or demeaning project to a department head, who in turn may want to share his or her good fortune with subordinates or co-workers. The situation has now become ripe for a shanghai, since asking for willing volunteers would be futile and the work still needs to get done. The department head may simply order a subordinate or two to stop what they're currently doing and take on this project. While a shanghai may be phrased in the form of a polite request, the reality is that refusal is not a viable option.