British Prime Minister Margaret Thatcher told an unusual joint session of the Canadian Parliament today that "it is time for freedom to take the offensive" in an ideological war against the Soviet Union.

Thatcher, the first British prime minister to visit Canada in 25 years, thumped away at her familiar theme of Soviet menace.

"For any who doubted the nature of the Soviet system . . . the shooting down of the Korean airliner has come as a most terrible and tragic reminder," she told the House of Commons and Senate meeting together in the ornate House chambers on Parliament Hill.

Emphasizing the historic political and cultural ties between Britain and Canada, Thatcher said the West must engage Moscow at the political level while remaining militarily strong enough to deter Soviet aggressive instincts. "There must never be an imbalance in any range of armament that leads to the conclusion that aggression against us might succeed," she said this afternoon.

Thatcher, a staunch supporter of the U.S.-backed plan to deploy advanced Pershing II and cruise missiles in Western Europe to counter improved Soviet nuclear weapons, declared: "As the moment for deployment draws near, it is in Moscow's power to ensure by accepting the zero option that not a single missile of this kind is put in place."

The zero option plan, put forward by President Reagan, would ban the Soviets' SS20 medium-range nuclear rockets in return for cancellation of the Pershing and cruise deployment.

The Parliament interrupted Thatcher eight times with enthusiastic applause and cries of "Hear! Hear!" The response was especially strong when she asserted that NATO must proceed with the new missile deployments.

"Our nerve is being tested. To falter now would be fatal," she said. Her delivery was firm and relaxed, the demeanor of a leader among friends.

Canadian Prime Minister Pierre Elliott Trudeau and Thatcher have had disagreements over how to manage East-West relations, with the British leader taking a generally harder line toward Moscow. But Trudeau in a brief introductory speech, called her a "very special" visitor whom Canadians hold in high esteem.

At a press conference after her address, Thatcher took pains to say that Canada under Trudeau had been a reliable ally in the North Atlantic Treaty Organization. The British leader will fly to Washington Wednesday and will confer with the president.

Thatcher flew here Sunday night from London with her husband and a retinue of senior British officials. This morning she had a private working session with Trudeau, the host of state dinners in her honor tonight in Toronto and tomorrow night in Edmonton. Thatcher also plans to meet the new Conservative Party leader, Brian Mulroney, and other politicians.