In the 1800s, long sea voyages were very difficult and dangerous, so people were understandably hesitant to become sailors. But sea captains and shipping companies still needed crews to sail their ships, so they gathered sailors any way they could — even if that meant resorting to kidnapping.
The word “shanghai” comes from the name of the Chinese city of Shanghai. People started to use the city’s name for that unscrupulous way of obtaining sailors because the East was often a destination of ships that had kidnapped men for their crew.