Multiple realities(covers information from several alternate timelines)
A katana was a traditional Japanese sword.
In 2258 of an alternate reality, Hikaru Sulu's counterpart used a retractable sword resembling a katana to fight off the Romulans. (Star Trek)
A samurai wielding a katana appeared to the crew of the USS Enterprise during a visit to the Shore Leave Planet in 2267. (TOS: "Shore Leave")
In 2268, after the Beta XII-A entity altered the matter on the USS Enterprise to create primitive weapons, Lieutenant Hikaru Sulu was given a katana. (TOS: "Day of the Dove")