I'm assuming that you are referring to pre-1866 Prussia, which was indeed separated into several parts that were not connected by land - one part in modern eastern germany / western poland and one in modern western germany. Finally, there was the Prussian exclave of Hohenzollern province in southern germany, surrounded by Würtemberg and Baden.
The eastern portion had been wholly prussian following the treaty of Tilsit in 1807, consisting mainly of Brandenburg, Schlesien, Pommern and Preussen itself. Additionally, parts of Saxony and Poland, as well as Swedish pomerania, was added following 1815.The western portion was conquered by Prussia following the end of the napolenic wars in 1815, consisting mainly of territory from the Kingdom of westphalia and the previous confederation of the Rhine.
This separation was largerly ended following the Second Schleswig war (1864) and the Prusso-Austrian war of 1866, after which Prussia established itself as the dominant German state. The aftermath of these wars lead to the provinces of Hesse-Nassau, Hanover, Holstein and Schleswig being admitted into Prussia, connecting the eastern and western halfs of the kingdom over land. The southern exclave of Hohenzollern wasn't connected to 'mainland' Prussia until 1871, when the remaining German states (excluding Austria-Hungary) were amalgamated into The German Empire.