A prediction, via satirical anti-socialist German writer Eugene Richter (one-time leader of the Liberal Party in the Reichstag) in his 1891 work Pictures of a Socialistic Future, of the necessity of strong border protections in the socialist commonwealth (though he specifically predicts merely murderous guards, not a wall per se):

Socialism is founded upon the principle that it is the duty of all persons alike to labour, just as under the old regime the duty to become a soldier was a universally recognised one. And just as in the old days young men who were ripe for military service were never allowed to emigrate without authority, so can our Government similarly not permit the emigration from our shores of such persons as are of the right age to labour. Old persons who are beyond work, and infants, are at liberty to go away, but the right to emigrate cannot be conceded to robust people who are under obligations to the State for their education and culture, so long as they are of working age...

Under these circumstances the Government is to be commended for stringently carrying out its measures to prevent emigration. In order to do so all the more effectually, it has been deemed expedient to send strong bodies of troops to the frontiers, and to the seaport towns. The frontiers towards Switzerland have received especial attention from the authorities. It is announced that the standing army will be increased by many battalions of infantry and squadrons of cavalry. The frontier patrols have strict instructions to unceremoniously shoot down all fugitives.

Link via Bryan Caplan.