MUNICH, West Germany (AP) _ France will withdraw about half of its 50,000 troops in West Germany in the next two years and plans to eventually withdraw them all, leaders of the two nations said today.

The pullouts are part of a larger reduction of foreign troops based in West Germany. The United States, Britain and other NATO members also plan to cut their forces on West German soil.

''The French government ... has told the German government it intends to reduce its armed forces ... by half in a first phase,'' French President Francois Mitterrand and Chancellor Helmut Kohl said in a joint statement.

Later, at a news conference, Mitterrand said his government's goal is the eventual complete withdrawal of French troops, in view of the fact that Germany will regain total sovereignty after unification on Oct. 3.

But he said ''German interests'' must be carefully considered. Many West German communities are worried about the commercial effects of drastic reductions of foreign troop deployments.

Mitterrand said he was prepared to discuss with Kohl's government ''modalities of the troop reduction.''

Three French divisions are deployed in West Germany, as well as a joint West German-French brigade and French troops stationed in West Berlin. The German-French brigade and the troops in West Berlin are not affected by the withdrawal, said the statement issued after two days of meetings.

Kohl and Mitterrand reaffirmed their commitment to work toward European unity in the statement.

''We are determined to work toward the creation of a European confederation in which all states of our continent will work together with equal rights,'' the two leaders said.

''German unity opens up new possibilities for closer cooperation in all areas, especially economics and culture,'' said the statement, referring to the merger of East and West Germany, set for Oct. 3.

Both leaders urged higher levels of French and German investment in East Germany's beleaguered economy.

The two nations also vowed to strengthen ''cooperation with the states of North Africa and the eastern Mediterranean within a European framework, as a contribution toward peace, toward economic and social progress, and ecological protection in that region.''

Kohl and Mitterrand today concluded a second day of bilateral talks on a wide range of matters, including German unification and the Persian Gulf crisis.