Okinawa was militarized long before the advent of recorded history and localized war was as common there as anywhere else where competing tribes fought to protect themselves. Mainstream Japanese fighting techniques and philosophies entered the island from the Heian period (794-1185) onwards through visiting aristocrats who brought with them a retinue of bodyguards that were skilled in the use of the halberd, spear and sword, and who could perform archery (the chosen art of the samurai before the sword gained ascendancy) and grapple. This knowledge was absorbed by indigenous warriors exposed to it and put to good use in violent territorial disputes among local warrior chieftains between the seventh and fifteenth centuries.
One such example cited by Patrick McCarthy (though it is disputed by mainstream historians) was the influence of Minamoto Tametomo of the Minamoto clan. According to McCarthy, in his career Tametomo overran Kyushu (the southernmost area of mainland Japan) after being exiled to Oshima Island (in the Izu Island chain) following defeat by the Taira clan and his subsequent escape. From Kyushu Tametomo moved further south to Okinawa. Marrying into the family of a local warlord Tametomo's son, Shunten, went on to become the most powerful warrior chief on the island with his dynasty lasting until 1253, a period in which martial arts from the Japanese mainland became further embedded into the Okinawan way of fighting. This is the story believed by certain residents in Okinawa, but historians argue the events are fictitious and were created at a later date to attempt to legitimize Japanese dominion over the Ryukyu Islands. There is a similar story (also not true) told on Amami Oshima, a major island to the north of Okinawa.

Minamoto Tametomo. Tametomo was famed for his skill with the bow, the 'badge' of the samurai class before the katana and wakizashi emerged as the more famous signifiers of the warrior elite.
For the next two centuries localized warfare continued between three primary areas until, in 1429, Sho Hashi was able to emerge victorious and form a centralized government. Though 1429 is a significant date in the overall history of Okinawa, a date of more importance to the history of karate is 1507 when Sho Shin-O ratified the 'Act of Eleven Distinctions', one of which prohibited the ownership and stockpiling of private weapons. Suddenly there was no access to weapons as a means of personal self-defense and, at a deeper level, the techniques and martial strategies that had developed under the influence of the armed warriors from mainland Japan had no apparent means of expression. Without a physical sword the technique and strategy of using a blade in combat appear to become redundant. From 1507 onwards then the people of Okinawa turned to the investigation of unarmed combat techniques in lieu of the possibility of making an armed response to an aggressor. These weaponless fighting approaches would, many changes later, one day become various schools of karate.
As important as the date of 1507 is in understanding the historical development of karate, the ban on the ownership of weapons is not a simple watershed. It is not true that prior to 1507 Okinawan warriors exclusively used weapons in combat and after they adopted unarmed systems of combat. The fighting arts that later developed into karate did not appear out of nowhere.
In his book Bible of Karate: Bubishi Patrick McCarthy identifies various streams of Chinese influence on the indigenous te fighting styles. It is in this synthesis that the true origins of karate can be found and this synthesis accelerated after 1507 as warriors sought to become more efficient in their deadly trade sans their weapons.
The earliest recorded contact between Okinawa and China occurred in the early 7th century. Commerce and cultural exchange were slow to develop though and it was not until 1372, shortly after the demise of Mongol dominance in China, that an envoy was sent from China to Okinawa to invite the latter to become a tributary. Under the terms of the alliance trade between the two nations would increase and by the close of the 14th century a Chinese trading mission (known as the 'Thirty-Six Families') had been established in the capital city Naha. For the next five centuries, until the Ryukyu Islands were annexed by Japan in the 1870s, Chinese language and culture, including martial arts, was disseminated through Okinawa and the island chain. Close relations between the two countries also led to outstanding young Okinawan scholars being given the opportunity to travel to China to further their studies, opening the door for Chinese martial arts to be learned at the source and then transmitted back to the island.
Another possible source identified by Patrick McCarthy is the sapposhi, or special envoys and their entourage sent out to the furthest reaches of the Chinese Empire to improve communication. Over the course of 500 years before Japanese annexation twenty such envoys visited Okinawa, usually staying for a period of between 4-6 months. During these diplomatic missions it is possible that Chinese martial arts were further taught to select students.

The sapposhi and his large entourage. A possible source of knowledge of Chinese martial arts that influenced the development of karate?
The Pechin
One class within feudal Okinawan society that did perpetuate the practice of Chinese-influenced combative arts was the pechin. The pechin were middle-ranking warriors, somewhat equivalent to mainland Japanese samurai. Like the other classes, the pechin were created by Sho Shin and served in an official capacity from 1509 to 1879. Unlike the higher ranking classes, the pechin occupied positions and conducted affairs that brought them into direct contact with lower ranking citizens. For example, the pechin could be employed in civil administration or law enforcement. It was members of the pechin class pursuing a career in maintaining a lawful peace who can take more credit that any others for sustaining the practice of unarmed combat under direct Japanese rule.