This is a common question that frequents the mind of many Karatekas, since there are many images of the very creator of modern karate, Funakoshi Gichin, using weapons.
Developed in Shuri through the creators of hard-style Karate, from where Shōtōkan came, Kobudō (Okinawan weapons fighting / old martial way of Okinawa) continue to be taught by much of Shuri's derived styles even today. Kobudō and Karate-dō are two wheels of the same axle.
Why not Shotokan?
Kobudō was part of the curriculum in Shōtōkan-Ryū during the prewar period, that's why we can see photos of Funakoshi Gichin using weapons. In postwar Japan, however, all martial arts were banned by Military Occupation (1942 to 1945).
To reopen Karate classes, Masatoshi Nakayama (Funakoshi's student and first JKA Chief Instructor) convinced the authorities that Karate-dō was a harmless form of Chinese boxing. When questioned about the practice of swords or other banned arms, Nakayama assured that weapons weren't part of the Shōtōkan. Since then students of Shōtōkan have not touched arms anymore.
At that difficult time, leave Kobudō out was an unfortunate but necessary move to keep Karate-dō moving forward in the Japanese mainland.
Thanks to the work and perseverance of Shinken Taira, who studied for seven intense years under Funakoshi's supervision, Kobudō did not die, and later he became "the Father of the Modern Kobudō." Taira created the nunchaku kata taught in Ryukyu Kobudō 'Taira in the Nunchaku' and was also one of the teachers of Fumio Demura, a well known Japanese master of Karate Shitō-Ryū and Kobudō.
However, one question that hangs in the air is why the Kobudō has not been reestablished to Shōtōkan?
One answer might be the irrelevance of ancient weapons applied to modern times. However, on the other hand, wouldn't the training be essential to understanding the principles and applications better?