I would like to preface this answer with a disclaimer: I am not an expert in ancient/medieval warfare. My specialty and study is in the Second World War, so please defer to much more qualified responders than I should they appear.
Anyways, onto the question.
In my research of the topic (albeit far briefer than others), I have never come across mention of a weapon slung or placed in a scabbard upon the wielder's back. Generally, I would attribute this to two reasons:
(1) If a weapon were slung or placed in a scabbard upon the wearer's back, it would be unwieldy. This is a simple matter of physics and geometry. Bladed weapons that are too unwieldy to draw from a hip scabbard would be far too clumsy to be drawn from an over-the-shoulder scabbard and would generally have to exceed the length of 73cm. Such blades were unwieldy to draw from the shoulder position both due to their length and the awkwardness of the draw. In traditional Japanese swordplay after the Sengoku period (id est the Edo Period), samurai often practiced a form of the "quick draw" which were elements of kenjutsu. Many of these techniques focused on an ability to draw the katana quickly from a hip-side scabbard and deliver a lethal blow which would simply not be possible if the blade were over-the-shoulder. Bladed weapons such as swords were seen as a status symbol in many ancient/medieval societies for their ability to maim/kill quickly and at close quarters, and this would be counteracted by a blade too long that it had to be slung across the back. Likewise, a blade too short (id est a knife or dagger) would be insufficient in penetrating the armor of a knight or samurai. Thus, blades of medium length were preferred for their versatility and armor-penetrating capability.
(2) If a blade were too long, a secondary source to draw the blade would have been provided. This is certainly more speculative, so please take this with a grain of salt. As you could probably ascertain from histories of medieval warfare or even conclude from logic, reach of a weapon was very important in the pre-gunpowder era. Many of the weapons yielded by the levied peasantry or conscripts would be polearms which provided both reach and slashing ability against much more heavily armed adversaries were often mounted (hence the popularity of the halberd in late medieval Europe). However, that basic principle of reach also applied to nobility, where bladed weapons were more common and often more desired for their versatility. As such, greatswords (or zweihaenders in German) were preferred in many medieval combatants in the Late Middle Ages, but these weapons were never slung over the back and were provided by a squire when required. They were simply too unwieldy to be worn day to day, and were only fielded for special occasions. As such, they were never, to my knowledge, commonly slung over the back as so often depicted in video games or movies.
I must reiterate that my experience in severely limited and that you should defer to the far more researched knowledge of other experts should they answer this question. In lieu of their responses, I hope that this proves satisfactory in answering you question. If you have further questions, I will seek to answer them or find a more experienced responder who can.
We have removed many posts in this thread, mostly for the same handful of reasons; speculation, personal anecdotes and 'placeholder' answers are all against our rules. Do not write an answer if you have not done research relevant to this topic, if your only source is personal experience or if you feel that your answer is inadequate and needs to be extrapolated on by an expert.
If this never really happened in real life, what is the fictional origin? He-Man?
In Cunliff's "Ancient Celts," he writes:
Among the Parisii of Yorkshire, for example, the sword was sometimes worn across the back and had, therefore, to be drawn over the shoulder from behind the head.
Here's a link to a not very helpful google book page link.
He seems to suggest that there is evidence for this in the iconography and surviving texts, although it's hard to get much detail from the keyhole of information you can see through google books.
The word for that type of shoulder belt is a baldric, and according to this source they were used in Ancient Greece and Rome for weapons such as swords and shields. In modern times a similar shoulder apparatus is used for other tools and instruments, like drums or horns in parades.
Like everyone else, ninja wore their swords on the hip because it's the best position for drawing and it was inconspicuous, but they strapped their swords on their backs when the situation called for it. They did a lot of acrobatic work like climbing, scaling, and running which would be very cumbersome with a sword slung on the side. Luckily, they favored swords that were shorter and straighter than the average katana.
A deleted comment has claimed that ninjato are a purely cinematic invention and that actual ninja never used specialized swords. It was half right. There is no historical usage of the term ninjato but the swords the ninja did use were roughly what we see in the movies, so it's really an issue of terminology. It'd be like saying Minamoto no Yoritomo wasn't a samurai because samurai is a relatively recent term. Even today, samurai are referred to almost exclusively as bushi (the generic word for warrior) in Japanese discourse.
We don't have any info about what a ninja would do if he was compromised while having his sword strapped to his back but I personally like Greg Pak's reconstruction of how they might've addressed it.
Source:
Bansenshukai by Fujibayashi Sabuji. Compiled in 1676, much of it is made up of known training regimes and tools used by the ninja clans of Iga and Koga. I used Antony Cummins' translation.
What about for travelling through safe country or with more than one weapon? Surely it would be easier to have a sword across your back. Or were roads too dangerous in the past where you couldn't be unprepared
Short answer? No.
Longer? Any sword longer than maybe a short sword would not be possible for the user to pull from the scabbard. This is because swords are almost always longer than the arm that draws them. Here is a great video about it: https://www.youtube.com/watch?v=IocQ_DZVAU0