Soon after the start of World War I the German War Ministry recognized that the multitude of different steam locomotives not only greatly affected railroad operations essential to the war effort but also the maintenance of the locomotives themselves. The War Ministry therefore requested as early as 1915 the development of a powerful standard design freight locomotive with the smallest possible axle load (16 tons). A commission was formed to complete the plans for this locomotive. This commission had representatives of the railroads and the military. In the end, the Prussian members pushed through the construction of a 2-10-0 hot steam locomotive.
At the start of 1917, the Borsig Works were given the contract to generate the design documents for the new locomotive. The new "standard design locomotive" was developed in the shortest amount of time by borrowing from a 2-10-0 locomotive for Turkey. The first units were completed in 1917 and were designated the class G 12 in Prussia, Württemberg, and Baden. In Saxony, the G 12 was designated as the class XIII H. With a boiler height of 3,000 mm / 118-1/8", the Belpaire firebox, and the continuous bar frame these units had nothing more in common with Prussian locomotive building tradition. The low bar frame allowed the firebox to be set on the frame and to be widened on the sides compared to earlier sheet metal frames. For the first time the grate surface could be achieved not only with the grate length but also with the grate width. Other new features were Coale design safety valves as well as a standard design feeder water purifier. Between 1917 and 1921, 1,158 units were built just for the Prussian State Railways and later for the DRG by AEG, Borsig, Hanomag, Henschel, Krupp, Linke-Hofmann, Rheinmetall, and Schichau. The Baden, Württemberg, and Saxon State Railways ordered additional G 12 locomotives. In the DRG plan of 1925 for new class numbers the Baden G 12 units changed to the DRG class 58.2-3, the Saxon G 12 units (sä. XIII H) to the class 58.4, the Württemberg G 12 units to the class 58.5, and the Prussian G 12 units to the class 58.10-21.
They were used in almost all of the German State Railroad districts. World War II caused numerous units to be left abroad, such as Bulgaria, Austria, and Poland. The locomotives remaining on the DB were retired by 1953. By contrast, the DR locomotives were indispensable for a long time and ran in their original version in the Erzgebirge region until 1976. Several G 12 locomotives have remained preserved, among them the operational road number 58 311 owned by the Ulm Railroad Fans.