A high ping results when one or more parts of the connection between the computer and the server is slow. However, connecting to a server in distant location can also cause a high ping. Sometimes, firewalls can cause high ping.
When connecting to a remote server, computers are routed through several different connections. Each connection tells the computer where to connect next, and any slow connection along the way can cause ping times to increase significantly. The ping time between a connection can only be as low as the slowest link allows.
In some cases, the so-called "last mile" of the connection is the slowest part. Consumer Internet connections typically force multiple people to share a single connection, and improper throttling can allow one computer to slow down everyone's connections. Internet service providers are sometimes slow to upgrade their infrastructure.
Traffic shaping on home or business routers can also causes higher ping times. This shaping is designed to provide better overall speed, but it may cause some network slowdowns. Reconfiguring the router can often fix this problem, and turning it off entirely may be best for some home users. Many routers now have traffic shaping turning on by default even though it is not necessary for most people.