"Together with the international community, Japan will send a message to make North Korea understand that things will get worse if it fails to respond to the international community's concerns," Shinzo Abe, the Japanese leader, said ahead of his visit on Sunday.
About 60 shots were fired at five North Korean soldiers who briefly crossed into the southern side of the demilitarised zone separating the two countries on Saturday.
The incursion was the first time since May that North Korean soldiers have crossed the highly sensitive border that separates it from the south.
It was unclear it was intended as a deliberate advance or an attempt to fish in a nearby stream, South Korean officials said.
The UN security council unanimously agreed on Friday to press North Korea to drop its plans to test an atom bomb, which Japan said could be detonated this weekend.
On Saturday, South Korea's nuclear envoy announced he will visit Beijing on Monday for two days of talks with Chinese officials about the threatened nuclear test.
Japan's foreign ministry said it was prepared to push for punitive measures at the UN if the North goes ahead with the test.
"If North Korea conducts a nuclear weapons test despite the concerns expressed by international society, the security council must adopt a resolution outlining severely punitive measures," the ministry said on Saturday.
Pyongyang has offered no immediate response to the UN move but renewed its call for the US to withdraw its forces from South Korea and said the risk of war was increasing.
"The ongoing 'reorganisation' of the US forces in South Korea is part of the arms buildup and a prelude to a war of aggression against the DPRK," the North Korean news agency KCNA said, quoting a statement by the Committee for the Peaceful Reunification of the Fatherland.