EAST BERLIN, AUG. 31 -- One day before the anniversary of the beginning of World War II, a war that ended in their partition, the German states signed a sweeping treaty meant as a final blueprint for bringing them together.

German leaders met today in a 17th-century palace of German princes to sign the document, which seeks to reconcile the stark differences between two societies that will form one nation Oct. 3.

The pact will allow East Germany to retain its liberal abortion law until at least 1992, the deadline for a united parliament to write a new law for the entire nation. It also gives Western investors more rights to buy East German land, a measure economists say is necessary to rescue the East's dire economy.

In addition, the pact calls for Berlin to become the capital of a united Germany, guarantees some social programs for jobless East Germans and recognizes the five states East Germany will become in a united nation.

The treaty leaves many crucial decisions facing a united Germany to the new government that will be elected to lead the country Dec. 2.

The 900-page document, signed by West German Interior Minister Wolfgang Schaeuble and East Germany's top unity negotiator, Guenther Krause, is expected to be approved by the parliaments of the two nations next week.

The treaty promises that the united Germany will respect the borders of its European neighbors. It also reconciles some fundamental legal and political differences between two nations that followed vastly different paths after they were carved from the conquered Nazi empire.

The treaty itself was not necessary to German unification because East Germany already has voted to merge with West Germany. But failure to approve it would have meant that West German laws would have become the law of both lands, with no accommodation of the vastly different society reared on socialism.

The treaty is a companion piece to the economic pact that merged the currencies and economies of the German states on July 1, when East Germany became a free market after four decades of a government-controlled market.

Since then, East German joblessness has skyrocketed as factories collapse in the face of Western competition. The document includes an important provision meant to lure more Western companies into East Germany and help stabilize the economy there.

Tens of thousands of West Germans and others who fled what is now East Germany after the Soviet invasion of World War II have filed claims on their former property. The uncertainty of who owns what in East Germany has been blamed for inhibiting Western investment intended to provide jobs and replace the dying sectors of the East German economy. The treaty gives Western investors who buy East German land protection from any claims made by former owners or their heirs, who will instead be compensated with cash under a system to be worked out later.

The nations also agreed that the new, united parliament will decide what to do with the files compiled by the notorious East German secret police, which kept sensitive information about millions of people.

In the meantime, the files will remain in what is now East Germany, under the custody of a West German official to be chosen by East Germany.