A prewar stint in Germany wouldn't have helped him acquire a pistol that was reportedly produced in 1944.
But there are a number of routes by which this late war German pistol could have made it into a Japanese officer's hands.
There were some Japanese submarines that made trips to German territory throughout the war, with the last trip being in March 1944. It could have been acquired during that last trip.
There were also a fair number of German submarines that made trips to Japanese territory, including several that based themselves out of Japanese naval bases for operations in the Pacific/Indian Ocean. A small number of these vessels were even seized and operated by the Japanese after the German capitulation. The pistol could have belonged to a crewmember of one of these German ships that made its way to Japanese territory in 1944/1945, and come into Japanese hands through trade or capture.
And there was a small amount of personnel transit between Germany and Japan throughout the war, by diplomatic couriers, embassy staff transfers, military attaches, etc. It could have been brought from Germany to Japan by one of these in 1944/1945.