Harper's spokesman, Jason MacDonald, said the prime minister was speaking to a group of G20 leaders at a private leaders' retreat on Saturday morning when Putin approached and extended his hand.
MacDonald said Harper told Putin: "I guess I'll shake your hand but I have only one thing to say to you: You need to get out of Ukraine."
According to MacDonald, Putin did not respond positively. He didn't provide further details.
But a spokesman for the Russian delegation said Putin's response was: "That's impossible because we are not there."
Harper and the leaders of the world's top economies began the annual summit in a tense atmosphere dominated by Western anger towards Putin and pressure to address climate change, fight Ebola and kickstart economic growth.
A senior government source had earlier stated that Harper had no intention of talking to Putin during the summit, noting the Russian leader was well aware of Canada's position on his aggression in Ukraine. That changed when Putin approached his Canadian counterpart.
The brilliant blue skies overhead this seaside city buzzed with security helicopters as the leaders, including Putin and U.S. President Barack Obama, arrived at the Queensland Parliament House in downtown Brisbane for the retreat.
Harper chatted with British Prime Minister David Cameron as they entered the stately stone building on a steamy morning. The city is currently enduring a record-breaking heatwave, with the mercury expected to climb as high as 40 C on Sunday.
The summit was meant to focus on economic issues. Australian Prime Minister Tony Abbott officially opened the summit with a pledge that world leaders would deliver on an initiative to add $2 trillion to the global GDP, vowing freer trade and more investment for infrastructure.
He said the leaders' plans for growth would add millions of jobs and boost the world's GDP by more than two per cent.
But it was clear that Putin's actions over the past few days were top of mind for the leaders.
Abbott lashed out at the Russian leader for apparently flexing his military muscles by sending four Russian navy ships to stalk Australia's northern coast in the days leading up to the G20 summit.
"Russia would be so much more attractive if it was aspiring to be a superpower for peace and freedom and prosperity, if it was trying to be a superpower for ideas and for values, instead of trying to recreate the lost glories of tsarism or the old Soviet Union," he said.
Cameron threatened Russia with further sanctions if it doesn't resolve the Ukrainian conflict amid reports that Russian troops and tanks are flooding into the eastern reaches of Ukraine.
Harper has been a vehement Putin critic for months, with Canada and Russia trading a number of retaliatory sanctions.
He recently condemned the “continued penetration of Russian presence in eastern Ukraine and obvious actions … to extend and provoke additional violence. That’s of great concern to us.”
Russia, meantime, took aim at France on the eve of the summit, threatening "serious" consequences if it fails to deliver a warship whose handover has been delayed by the events in Ukraine.
Putin also assailed his fellow G20 nations for imposing sanctions at all, saying in an interview with Russia's state media that the measures violated G20 principles.
Amid those hostilities, the stage was set for face-to-face meetings that promise to be crackling.
Harper arrived in sweltering Australia from chilly New Zealand late Friday night and told the media he agreed with Abbott, the summit's chairman, that the event should focus on economic issues.
But he added he expected the recent climate change deal between the U.S. and China, setting limits on greenhouse gas emissions, would also be a topic of discussion among the leaders of the world's top economies, as well as a host of other issues.
On the sidelines of the summit, Obama pledged a US$3 billion contribution to the so-called Green Climate Fund to help poor countries adapt to climate change and develop cleaner sources of energy.
The move reportedly is part of Obama's intention to use his last two years in office pushing forward climate change policy.
Environmentalists have demanded climate be on the agenda at the G20 meeting, and the head of the United Nations, Ban Ki-moon, called on the G20 to make the environment a priority in a news conference at the summit.
"Climate change is the defining issue of our times; it's only natural that G20 leaders should focus much more on this," he said.
Hundreds of protesters were in Brisbane staging largely peaceful demonstrations and marches, mostly to demand action on climate change from the leaders of the world's top 20 economies.
But there were protesters calling for action on a variety of issues under heavy police watch, including 100 Tibetan ex-political prisoners and supporters who urged world leaders to support an end to China's occupation of the region.
Violent protests have marred previous G20s, including in Toronto four years ago.
The G20 is also facing calls to come up with a financial response to the Ebola epidemic in western Africa. Health-care workers battling the outbreak have been pleading for more resources.
World Bank president Jim Yong Kim says a proposed global emergency fund to contain the next Ebola outbreak has the interest of many finance ministers and central bank governors. He's in Brisbane for the summit.
MacDonald, Harper's spokesman, said the fund was an "interesting idea in principle."
"But we would need to see additional details on the mechanism, how it would work, and what the accountability measures would be," he added.
Later Saturday, the leaders took in a welcoming ceremony that featured Australian aboriginal performers. Harper sat next to Obama for part of the festivities.
Follow Lee-Anne Goodman on Twitter @leeanne25
Also on HuffPost