Many of hundreds of years ago people did not need any form of travel documentation and had free movement across the globe.
The first known document for travel dates back to 450 BC and is documented in the Christian Bible. This letter/document granted the permission to travel to certain territories.
The UK first started issuing passports in the 15th century with King Henry V introducing them. These passports consisted of a letter which allowed people to enter into walled cities in foreign countries. These passports where essentially both a visa and a passport.
Prior to wartime when there was relative peace globally passport controls had been relaxed and entry into foreign countries was nowhere nearly as stringent as it is today.
However, the documents that were initially issued during WW1 are the most succinct to modern day visas. According to historical research, Russia where the first country to issue these documents.
If any individual intended to travel to Russia they would first need to obtain a travel document to do so. Germany, France and Switzerland quickly followed suit and passport control and travel documentation where re-introduced and entry into foreign countries became harder.
It was at this point that both passports and visas took on the kind of form that we are used to today. With the advances of technology passports and visas have evolved to the point we are at now with online applications and biometric passports.