The end of Japan's isolation wasn't voluntary - Japan was forced
out of its isolation by American gunboats sailing into Tokyo
Bay. Basically, they saw the world being divided into colonizers
and the colonized, and decided they'd rather be the former.
(Despite being theoretically closed to all outside contact
before then, Japan did get some news from the outside, including
descriptions of the Opium war in China.) Military modernization
was a high priority from the beginning. Without going into too
much detail, in the late 19th/early 20th centuries, they
colonized Korea and a few others, and jockeyed with America and
European countries, including Russia, for influence in China.
That was just how the international game was being played at
that time. Then they were hit especially hard by the Depression
of the 30s. They depended a lot on export trade, much more so
than America. Japan wasn't nearly as rich, either financially or
in natural resources, so you can imagine how much worse off
Japanese workers were when