Washington and Moscow flooded the Korean Peninsula with arms and aid as they fueled the war between South and North seven decades ago. Now, in a fateful moment of history turning back on itself, Russia and the United States are reaching out to those same allies to supply badly needed munitions as the powers face each other down again, this time on the other side of the globe, in Ukraine.

When President Vladimir V. Putin met North Korea’s leader, Kim Jong-un, in Russia’s far east on Wednesday, they struck what North Korea called “a satisfactory agreement​” on “the immediate cooperation matters​” between the two states, which have found common interests in opposing the United States and its allies. If any specific arms deal was struck, neither Moscow nor Pyongyang was expected to announce it. Buying weapons from North Korea or providing help for its weapons programs are violations of United Nations Security Council resolutions that Russia itself voted for.

Matthew Miller, a spokesman for the State Department in Washington,​ characterized the meeting ​as Mr. Putin “​begging Kim Jong-un for help.” But it is not just Russia turning to the Korean Peninsula for aid: Under deals worked out quietly with Washington, South Korea has been shipping large amounts of artillery shells to the United States for months. It insists that it is not supplying any lethal weapons directly to Ukraine. But its shipments to the U.S. military help free up American stocks for Ukraine to use in fighting Russia.

The Korean War never officially ended after the guns fell silent in a cease-fire in 1953. ​Still technically at war, ​both Koreas have since engaged in an arms race, building two of the world’s largest standing armies, with large stockpiles of weapons.

​North Korea, though isolated and impoverished, has prioritized a military buildup, with its propaganda machines urging constant vigilance against American invasion. It developed its missiles by reverse-engineering Soviet systems. It is believed to have built its first intercontinental ballistic missiles with black-market rockets from Ukraine. The country has also earned cash by selling weapons to countries like Syria and Iran.

South Korea has built its defense industry by copying weapons provided in military aid from the United States. It also grabbed technology where it could, developing its first space rocket with Russian technology. It, too, leveraged its arms industry for exports, winning multibillion-dollar contracts ​to sell tanks, howitzers, warplanes, missiles and armored vehicles to help feed the demand driven, in part, by the war in Ukraine.

“In the post-Cold War era, South and North Korea have been virtually the only countries that have remained on a constant war footing, with large artillery and other weapons stockpiles ready to use,” said Yang Uk, a military expert at the Asan Institute for Policy Studies in Seoul. “The fact that South and North Korea remain stuck in a Cold War armed confrontation explains why Washington and Moscow come to them seeking weapons.”

Artillery ammunition has been in particular demand as both sides in the Ukraine conflict tear through their stores faster than production can catch up. South Korean and American officials have been tight-lipped about how many shells South Korea has provided to the United States, and Seoul treats information on its weapons stocks as top secret. But recent news reports indicated that South Korea has sold or lent at least hundreds of thousands of artillery shells to the U.S. military.

Moscow has repeatedly warned Seoul against supplying weapons to Ukraine. But South Korea has been pressed by the United States, its most important ally, to help the war effort. The administration of President Yoon Suk Yeol decided to supply shells to the United States, designating it as the “end user” for the munitions.

“It’s basically left to the U.S. to decide whether to send the shells it received from South Korea to Ukraine,” Mr. Yang said.

So far, no evidence has emerged that shells made in South Korea have been used in Ukraine. Nor has there been any public evidence that Russia has used North Korean arms and ammunition on the battlefield in Ukraine — evidence that Washington would be eager to publicize. But U.S. officials have repeatedly warned that North Korea was shipping artillery shells and rockets to Russia.

Arms deals between Mr. Kim and Mr. Putin could prompt hawks in South Korea to call for sending weapons directly to Ukraine — another reason Moscow and Pyongyang would likely refrain from publicizing such deals. But North Korea does have what Mr. Putin is seeking.

“Most likely, North Korea has tens of millions of shells for artillery in stock,” said Siemon T. Wezeman, an arms researcher at the Stockholm International Peace Research Institute in Sweden, noting that the country is estimated to have up to 10,000 artillery guns of 100 mm or higher calibers — more than the total of such weapons in use by all NATO countries. North Korea’s weapons are based off Soviet designs, and its artillery shells are in calibers used by Russia.

“Basically, Russia has a large number of guns that are compatible with North Korean ammunition,” Mr. Wezeman said. “The only ammunition North Korea cannot supply is smart ammunition. North Korea produces mainly the good, old, dumb, unguided — and thus not very precise — shells and not the more effective guided shells.”

One big question is how fast North Korea could supply munitions in the amounts Russia needs without being caught.

North Korea runs a vast network of munitions factories, including 100 plants that each employ more than 10,000 workers, said Hong Min, an expert on the North Korean military at the Korea Institute for National Unification in Seoul.​ One site Kim Jong-un visited in August, described in state media as “a new light electrical appliance factory” under construction, is involved in making shells and gunpowder, Mr. Hong said.

“There seems to have been behind-the-scenes negotiation for North Korea to serve as a rear base of supplies for Russia,” he said.

In return for its weapons, North Korea hopes to get Russian food, energy and parts for its aging fleet of Soviet-era warplanes, tanks, howitzers and submarines, analysts said. It also covets recent versions of Russia’s Sukhoi fighter jets and its S-300 and S-400 air defense systems, they said. While hosting Mr. Kim at the new Russian spaceport, the Vostochny Cosmodrome, Mr. Putin indicated that Russia may help North Korea with its troubled military spy satellite program.

​Mr. Kim was expected to visit weapons factories and naval facilities in Komsomolsk-on-Amur and Vladivostok in Russia’s far east later this week.​

Analysts warn that Mr. Kim’s diplomacy with Mr. Putin entails more than weapons trade, signaling a broader shift in his policy — from seeking negotiations with Washington to more definitively aligning with Russia and China against the United States.

But despite the warming ties between Russia and North Korea, there is still doubt that Mr. Putin would go so far as to provide North Korea with technology to perfect its ICBMs or build nuclear-powered submarines.

“Even a desperate war machine does not trade its military crown jewels for old, dumb munitions,” said Professor Leif-Eric Easley of Ewha Womans University in Seoul. “Trust is so low among Russia, North Korea and China that a real alliance of the three isn’t credible or sustainable.”