The Prime Minister’s comments came as Ukraine’s president Volodymyr Zelensky addressed the leaders of the UK, US, Canada, Japan, France, Germany and Italy by video-link from Kyiv.
His address was made in private.
The G7 leaders are meeting in the luxury Schloss Elmau resort, Germany, for a key summit.
What Boris Johnson said
Mr Johnson argued that Western allies must continue to back Ukraine because standing up against Vladimir Putin’s aggression would ultimately make the world a safer and more prosperous place.
He said that if Vladimir Putin is not resisted, it could give the green light to countries such as China to pursue their own goals of territorial expansion.
The Prime Minister told the BBC at the summit in the Bavarian Alps: “I think that the economic impacts on the UK will start to abate, we’ll find ways around things and some of the cost pressures will start to come down.
“But just in terms of staying the course, imagine if you didn’t. Imagine if we allowed Putin to get away with the violent acquisition of huge chunks of another country, a sovereign, independent territory – the lessons for that would be absolutely chilling in all of the countries of the former Soviet Union, you can see what’s happening in the Baltic countries already.
“But the read across would also be felt in east Asia, as well.
“So, in terms of the economic effects of that, that would mean long-term instability, it would mean anxiety across the world.”
What’s been agreed at the summit
– The UK pledged £10 million to repair damaged Ukrainian rail infrastructure to create an overland route to get grain out of the country.
– The Government will also put £1.5 million to develop a testing process to identify whether grain sold by Russia on the world market has been illegally taken from Ukraine.
– The leaders are considering putting a price cap on Russian oil to further cripple the economy bankrolling the war effort.
Support people fleeing the devastating conflict in Ukraine: donate to the DEC appeal
Disasters Emergency Committee (DEC) charities and their local partners are in Ukraine and in neighbouring countries providing food, water, shelter and medical assistance. Learn more and donate what you can today
Here are the latest updates on the Russian invasion of Ukraine.
Latest updates on Russia’s invasion of Ukraine
Ukraine’s Volodymyr Zelensky is understood to have told G7 leaders not to let the conflict in his country “drag on over winter”.
He told the leaders gathered in Germany that “if Ukraine wins you all win”.
And in a sign he was not willing to back down and accept a peace deal that gave up swathes of Ukraine to Russia, the president said: “We will only negotiate from a position of strength.”
In a joint statement, the G7 leaders promised to support Ukraine “for as long as it takes”.
They said: “We will continue to provide financial, humanitarian, military and diplomatic support and stand with Ukraine for as long as it takes.
“As we do so, we commit to demonstrate global responsibility and solidarity through working to address the international impacts of Russia’s aggression, especially on the most vulnerable.”
Boris Johnson has said G7 leaders remain united in their support for Ukraine in the face of Russia’s ongoing offensive on its territory.
Speaking at the G7 summit in Germany, the Prime Minister said: “What has really struck me in the last couple of days is the amazing consistency of our resolve and the continuing unity of the G7. That has certainly shone through in the conversation in the last couple of days.
“The logic of the position is so clear. There is no deal that President Zelensky can do, so in those circumstances the G7, the supporters of Ukraine around the world, have to continue to help Ukrainians rebuild their economy, to get their grain out, and of course we have to help them to protect themselves.”
Environment Secretary George Eustice has admitted it would be a “big challenge” to get grain out of Ukraine by rail.
Questioned about the logistical difficulties of such a move, he told BBC Radio 4’s Today programme: “This is a big challenge. If it were easy, we would have found a way of doing it so far.”
But he said that moving it by ship through the Black Sea would be fraught with difficulty.
“You’ve got a very perilous situation for shipping in the Black Sea. It’s mined. Ukraine themselves, for defensive and security reasons, have secured that port and they’re not letting shipping in anyway.
“It therefore probably means that a rail route would be the most likely, the most successful, but, as you say, that’s not easy either.
“This is something we should apply our minds to, to try and find a way of getting this wheat out.”
French European affairs minister Clement Beaune has warned it could take "15 or 20 years” for Ukraine to be made a full member of the EU.
Mr Beaune told Radio J in Paris: "We have to be honest. If you say Ukraine is going to join the EU in six months, or a year or two, you're lying.
"It's probably in 15 or 20 years, it takes a long time."
The French minister’s comments will come as a blow to Ukrainian President Volodymyr Zelensky, who hoped to secure a speedy entry to the bloc after Russia's invasion.
France’s President Emmanuel Macron has offered a compromise of creating a "European political community" - a halfway house to EU membership - but Mr Zelensky has rejected the proposals.
Ukraine military command has instructed soldiers to “save the lives of soliders” and stop defending the city of Mariupol.
The city, which has been heavily under-seige since the beginning of the war, was at the centre of a bloody battle for control of the Azovstal Steel Works.
The complex had sheltered civilians, who have now been evacuated, and was the last holdout for Ukrainian forces in the city, however Russia’s top military official has said that the steel plant has now been “completely liberated”.
US President Joe Biden has announced the country’s largest-ever aid package to Ukraine.
The US will hand over $40billon in aid to the country, the largest amount send to Ukraine since the beginning of the war.
President Biden said that the newly-announced aid pakcage was “a clear bipartisan message to the world” that the USwould support Ukraine in defending “their democracy and freedom”.
The package includes $6bn for security assistance, $8.7bn worth of US equiptment to be sent to Ukraine and $5bn to address global food insecurity as a result of the war.
Newly released CCTV footage has allegedly shown Russian soliders gunning down two unarmed Ukrainian civilians.
Believed to be filmed during the heigh of the conflict as it was centering on Kyiv, the footage shows two Russian guards approaching a business park in the city.
Two Ukrainian men are seen walking towards the soldiers with their arms in the air.
After walking away from the encounter, the Russian guards are seen returning and shooting the two men in the back.
Now, the US has urged social media platforms to not delete such footage from their sites, even if it goes against their posting policy.
US Democratic lawmakers said: ““If verified as authentic, this content could... help substantiate allegations of war crimes and other atrocities committed by Russian forces against the people of Ukraine.”
The Kremlin has said that Finland’s move to join Nato will not help stability and security in Europe.
Russian President Vladimir Putin has described Moscow’s military action in Ukraine as a forced response to Western policies.
Speaking at a military parade marking the former Soviet Union’s Second World War victory over the Nazis, Mr Putin drew parallels between the Red Army’s fighting against Nazi troops and the Russian forces’ action in Ukraine.
He said that the campaign in Ukraine was a timely and necessary move to ward off potential aggression.
The Russian leader added that troops are fighting for the country’s security in Ukraine, and observed a minute of silence to honour those who had fallen in combat.
The Russian President was speaking at a Victory Day parade in Moscow, which celebrates its triumph over Nazi Germany in 1945.