The Prime Minister also predicted Russia would face “ferocious” Ukrainian resistance as he promised to impose “heavy economic sanctions” in the event of an invasion.
Making a statement in the Commons on Tuesday, Mr Johnson also shared fears any invasion would result in “bloodshed comparable to the first war in Chechnya or Bosnia”.
He said: “This time the force arrayed on Ukraine’s frontier comprises over 100,000 troops, far bigger than anything Russia has deployed against her before.
“If the worst happens, and the destructive firepower of the Russian army were to engulf Ukraine’s towns and cities, I shudder to contemplate the tragedy that would ensue.
“Ukrainians have every moral and legal right to defend their country and I believe their resistance would be dogged and tenacious, and the bloodshed comparable to the first war in Chechnya or Bosnia, or any other conflict that Europe has endured since 1945.
“No-one would gain from such a catastrophe.
“The British Army leads the Nato battle group in Estonia and if Russia invades Ukraine, we would look to contribute to any new Nato deployments to protect our allies in Europe.
"If Russia pursues this path, many Russian mothers’ sons will not be coming home.
“The response in the international community would be the same and the pain that would be inflicted on the Russian economy will be the same.”
Mr Johnson revealed he had held meetings with Nato allies and agreed a universal response.
He said the steps following a virtual meeting on Monday night with key international leaders, including US president Joe Biden and French president Emmanuel Macron.
“We agreed that we would respond in unison to any Russian attack on Ukraine, in unison by imposing co-ordinated and severe economic sanctions heavier than anything we have done before against Russia,” he said.
“And we agreed on the necessity of finalising these measures as swiftly as possible in order to maximise their deterrent effect”.
Concluding his statement, Mr Johnson said he believed Russian aggression in Ukraine could be resolved through diplomacy. He said a war would “deserve the condemnation of history”.
The Prime Minister said: “I believe that all of Russia’s fears could yet be allayed, and we could find a path to mutual security through patient and principled diplomacy, provided that President Putin avoids the trap of starting a terrible war, and a war that we believe would earn and would deserve the condemnation of history.”
Responding to the Prime Minister’s statement on Ukraine, Sir Keir Starmer criticised Mr Putin’s acts of aggression in recent years.
The Labour leader said: “His Russia has annexed Crimea, supported separatist conflict in Donbass and now massed over 100,000 troops on Ukraine’s borders.
“These are repeated and unjustifiable acts of aggression so Labour stands resolute in our support of Ukraine’s sovereignty, independence and territorial integrity.
“That was made clear when our shadow foreign secretary and shadow defence secretary visited Kyiv a fortnight ago.
“For too long the implicit message to Moscow has been that President Putin can do what he likes and the West will do little to respond.
“We must now change course and show Russia that any further aggression will result in severe real world consequences.”