The K5 was the result of a crash program launched in the 1930s to develop a force of railway guns to support the Wehrmacht by 1939.
K5 development began in 1934 with first testing following in 1936 at Darlowo (German: Schießplatz Rügenwalde-Bad) in the former Farther Pomerania at the South coast of the Baltic Sea. Initial tests were done with a 150 mm barrel under the designation K5M.
Production led to eight guns being in service for the Invasion of France, although problems were encountered with barrel splitting and rectified with changes to the rifling. The guns were then reliable until the end of the war, under the designation K5 Tiefzug 7 mm. Three of them were installed on the English Channel coast to target British shipping in the Channel, but proved unsuccessful at this task.
Two K5 guns, named "Robert" and "Leopold" by German crews, were shipped to Italy to help counter the American landing at the town of Anzio in February 1944. The Allied soldiers stuck on the beach nicknamed the two German guns "Anzio Annie" and "Anzio Express" due to the express train-like sound the shells generated. On 18 May 1944 the guns fired their rounds and then escaped along the coastal railroad into the railyard in Civitavecchia, in preparation for evacuation. However, this was impossible and the guns were destroyed by their crews.