For the first time since the Korean peninsula was divided after World War II, civilians from North and South Korea will exchange visits to each other's capitals next month, it was announced yesterday.

The agreement, reached by officials of the two nations' Red Cross organizations meeting in the truce village of Panmunjom, provides for 50 members of divided families from each country to cross the border for reunions with relatives. It is the latest in a series of steps taken over the past two years to improve relations between the Seoul and Pyongyang governments, which fought a war in 1950-53 and remain bitter rivals.

South Korea's chief negotiator, Song Yong Dae, said that despite the limited number of visitors, the agreement "is significant because the visit represents a symbolic demonstration project for the future." About 10 million Koreans are members of divided families.

Each side's 50 family members will be accompanied by 50 folk dancers and singers, who will give two performances in Seoul or Pyongyang during the Sept. 20-23 visits, as well as by 30 reporters, 20 guides and a Red Cross official, for a total of 151 visitors in each delegation, according to official minutes exchanged in Panmunjom yesterday.

Song called the agreement "a milestone," and a number of observers agreed.

"It's a major breakthrough," said Chong-Sik Lee, a Korean-born professor of political science at the University of Pennsylvania. He called the announcement "very, very significant, and very encouraging," but warned that "the basic factors that created and prolonged the tension" between North and South Korea have not changed.

"It's a healthy, wholesome thing," said Donald L. Ranard, a former Korea desk director at the State Department and now senior consultant at Washington's Center for International Policy. "At long last, after all these years, there is an opportunity here for people from both sides to cross."

A State Department official agreed that the plan to exchange visits was the most significant step between the two Koreas since last September, when North Korea sent food, medicine and other relief after South Korea was hit by massive floods. The South Koreans dismissed that move as a propaganda stunt by their poorer neighbors but accepted the aid.

Lee, Ranard and other observers agreed that the gradual improvement of North-South relations was driven by each side's current needs.

North Korea needs improved trade with South Korea and its allies, the United States and Japan, Lee said. The Pyongyang government also is still working to repair the damage to its international relations caused by the 1983 bombing that killed 17 visiting South Koreans in Rangoon, Burma, and was traced to North Korean agents. Talks on trade and economic cooperation between the two Koreas, suspended after a shooting incident at Panmunjom in the Demilitarized Zone last November, are scheduled to resume Sept. 18.

South Korea's main concern, Ranard suggested, is to prevent a boycott or sabotage of the 1988 Summer Olympic Games, in which Seoul is investing $800 million. On Aug. 2, the South turned down a Pyongyang proposal for jointly hosting the games, but discussions on sports cooperation are to resume in Lausanne, Switzerland, in October.

Seoul "also needs some event that would accrue support for the government" domestically and internationally, Lee added, because of the rising strength of its political opposition, which made a strong comeback in parliamentary elections in February.

In the negotiations on the exchange of visits, the South had wanted family members to visit their home villages. The North Koreans refused, possibly because of reluctance to expose the poverty of their rural areas, and yesterday's agreement limits the visits to the two capitals. The other major issue, Ranard said, was the size of the delegations: the North wanted 700-member delegations, but was limited to 151.