The Canadian government expressed understanding today for President Carter's decision to cancel his visit here because of the Iranian situation. At the same time it called on all Candian citizens in Iran to leave that country.

The last minute cancellation threw Ottawa into a tizzy, with officials trying to halt preparations for what was to have been the first state visit since Prime Minister Joe Clark's election five months ago.

U.S. and Canadian officials said they expected the visit to be rescheduled for next January or February.

Despite the cancellation, both sides made major progress on several bilateral issues as senior officals on both sides worked up to the last minute to prepare areas of agreement for their leaders. Clark and Carter were to have accelerated final accord on several important issues.

Sources here say that energy was the area where early action is most needed. The Canadians want the United States to prepare the financing for the $15 billion natural gas pipelines to carry Alaskan gas across the Yukon and southern Canada to U.S. markets. The two governments had already agreed that construction should begin by Jan. 1.

The sources said the Carter administration has already obtained commitments from several major oil companies to help fund what will be the largest privately financed project in North America.

The Canadians are said to be prepared to endorse the "pre-building" of the southern portion of the pipeline and to permit a major increase in Canadian gas exports to the United States. The agreement will provide an additional 1 billion cubic feet of natural gas daily to the United States for six years. This would increase Canada's natural gas exports to the United States by one-third.

But the Canadians wanted a firm Washington commitment that the entire pipeline would be built. The facility will eventually also carry Canadian gas from Beaufort Sea to southern Canada.

Final approval of increased gas exports was expected next month when Canada's National Energy Board makes its final assessment on Alberta's gas surplus.

The U.S. and Canadian negotiators preparing for the Carter visit has also narrowed differences on a variety of joint energy projects, including coal conversion and the extraction of oil from tar sands. The Clark government was prepared to make more electricity, notably from Quebec and Manitoba, available to the United States, at least temporarily.

One of the issues causing some strain between the two countries is a pipeline for Alaskan oil. The United States appears to favor a plan that would involve shipments of oil by tanker to the state of Washington and then by a pipeline across the northern tier states into the Midwest. The Canadians, who do not want to be cut out, favor an overland route that would use existing facilities in Alberta and the Northwest Territories.

Moreover, the environmentally conscious Canadians strongly oppose heavy tanker traffic along the coast of British Columbia.

The Canadians were hoping that Clark would persuade Carter to accept Canada's so-called Trans-Mountain proposal, which would not eliminate the risk of tanker spills in the Strait of Juan De Fuca, but would offer some economic benefit through the construction of 573 miles of new pipeline in Canada needed for linking up with the existing system.