On the eve of crucial worker-government talks in Warsaw, Poland's top leaders -- party chief Stanislaw Kania and Prime Minister Jozef Pinkowski -- will travel to Moscow Thursday for a "friendly working visit" with Soviet leaders, the Polish press agency announced tonight.

The unexpected trip, reportedly at the invitation of the Soviet Central Committee, heightened the sense of approaching confrontation between the Polish Communist leadership and the increasingly powerful independent trade union movement.

There was no official word on whether the Moscow visit might force cancellation of a planned meeting Friday between Pinkowski and leaders of the national free union federation, Solidarity, which was set yesterday under the threat of selective strikes next month if certain union demands are not met.

The description of the trip as a "working visit" is diplomatic parlance in the Communist world indicating that the Polish leaders will have specific items to be discussed with their Soviet hosts.

The visit appeared to have been arranged at the last minute since, earlier in the week, Pinkowski reportedly had been prepared to meet Thursday or even today in Warsaw with Solidarity leaders.

The visit takes place amid increasingly ominous warnings from Poland's Warsaw Pact neighbors against concessions that threaten the supremacy of the Communist Party.

The nervousness has been most evident in neighboring East Germany, which yesterday announced restrictions in travel across its border with Poland. A similar step was reported to have been taken by Czechoslovakia, according to informed sources here, although there has been no announcement by Prague.

Washington Post correspondent Kevin Klose reported from Moscow that Western diplomats in the Soviet capital have found it all but impossible to get permission to cross into Poland at Brest.

What amounts to a virtual sealing of the Polish borders was placed against a backdrop of renewed warnings from East Germany today as the Communist Party newspaper, Neues Deutschland, asserted in Berlin that the political upheaval in Poland threatened the security of Europe as a whole, particularly if the Soviet Union were to become too disturbed about the Polish developments. East Germany leader Erich Honecker has explicitly warned the Polish leadership in recent days to rein in the independent union movement.

The precise nature of relationships between the Kremlin leadership and its Warsaw Pact neighbors is not a public matter, but previous meetings of this sort between the Soviets and other Eastern Europeans have come at times when Moscow has considered its interests to be on the line.

Just before Soviet and other Warsaw Pact troops invaded Czechoslovakia in 1968, there were crucial meetings between Czech and Soviet leaders, but political observers in Warsaw were quick to point out today that the Soviets were dealing with a party leadership in the Czech case with which they already had openly split, and that this is by no means the case with Kania.

The chief of the Czechoslovak trade unions, Karel Hoffmann, was quoted as saying the Polish trade union movement showed similarities to activities of the "antisocialists" in his country 12 years ago. He then expressed confidence that the Polish comrades would restore "their socialist-Leninist character."

With no public announcement of the motivation behind tomorrow's trip, speculation varied on whether it was an ominous summons for the Polish chiefs to receive clear and definite bargaining instructions, or whether it was a strategically timed move intended to strengthen the Warsaw government's negotiating position by reminding Polish workers of Moscow's key interest in events here.

Like a political chess game, Poland's power structure has become involved in a series of increasingly complex and interrelated moves that have taken place almost daily since the creation of independent trade unions bolstered opposition forces and threw Poland's Communist Party on the defensive.

By going to Moscow now, Pinkowski will be in position when he returns to the bargaining table with Solidarity leaders to point over his shoulder at the Soviet Union as an even more certain warning to workers not to push too far.

At the same time, the visit will afford Soviet leaders the chance to discuss negotiating tactics and future policies with the Polish chiefs before what is expected to be a crucial negotiating session in Warsaw.

While the Soviets are likely to argue for a hard-line stance, the Polish leaders, intent on establishing a working relationship with the new unions, are apt to make a strong case for the need to compromise with them. Kania himself has described the Solidarity campaign as a geniune mass movement, and the Polish Politburo today reaffirmed the irreversibility of the Gdansk agreement, signed Aug. 31, that guarantees the existence in Poland of independent trade unions.

Sensitive to its neighbors' views, one thing the Polish leadership has held fast to is its insistence that the new labor movement honor the leading role of the Communist Party in the state and other communist principles. But explicit recognition of these principles in Solidarity's charter has now become a central dispute since a Warsaw court ordered them written into the union's statute last week.

Certainly, the Warsaw leadership in recent days at times has felt as if it were in the middle of a tight sandwich, pressed between dissatisfied workers and frightened allies.

One key aim on the Polish side of the Kania-Pinkowski mission to Moscow likely will be a request for the Soviet leadership to relax some of the pressure tactics used on Poland by other Warsaw Pact members.

Tomorrow's visit will mark the first publicly known trip to Moscow by both Kania and Pinkowski since thy assumed their new positions.