It happened in 1884 at the International Meridian Conference in Washington DC.
Until that many countries used a local meridian to establish time and as the basis for navigation. However, increasingly global trade and navigation encouraged the adoption of a single system.
Interestingly going further back in time many localities used local meridians. In Nottingham U.K for example there is a brass line on the floor of the charming Bromley House Library which was used for local time setting. It became redundant when GMT was adopted nationally in 1847.