Johnson, who has offended some allies with flippant remarks, told Conservative Party members that the Libyan city of Sirte could be turned into the next Dubai by British investors if they could clear the bodies.
"They've got a brilliant vision to turn Sirte, with the help of the municipality of Sirte, to turn it into the next Dubai," Johnson said. "The only thing they've got to do is clear the dead bodies away and then we will be there."
Some activists from Prime Minister Theresa May's party laughed at the joke before the chair of the event changed the subject, saying: "Next question."
Britain and France took a leading role in the attacks that helped rebels overthrow Muammar Gaddafi in 2011. The country has since descended into chaos, with thousands of casualties.
The Islamic State militant group took over Sirte in early 2015, turning it into their most important base outside the Middle East and attracting large numbers of foreign fighters into the city. It was later cleared of the militants.
Britain's ambassador to Myanmar was forced to interrupt Johnson earlier this year as he tried to recite a nostalgic colonial poem by Rudyard Kipling in public during a visit to the country's most famous Buddhist site.
Enter a name and e-mail address and we will e-mail this website link too them.