His predecessor as PM Theresa May said it was "incomprehensible" the UK was not doing more to maintain a presence, while ex-minister Johnny Mercer demanded more help for veterans.
Labour leader Sir Keir Starmer accused Mr Johnson of "staggering complacency".
But Mr Johnson argued Nato's "core mission" in Afghanistan had succeeded.
Addressing a packed Commons, he said the country had been largely cleared of al-Qaeda terrorists, while the population had enjoyed better education, women's rights and free elections since the 2001 invasion.
But Conservative MP Tom Tugendhat, who chairs the Commons foreign affairs committee and himself served in Afghanistan, said it had been "shameful" of US President Joe Biden to question the willingness of the Afghan army to fight the Taliban.
And, in an emotional speech that was heard in silence, he told of grief and rage felt by veterans at the "abandonment" of Afghanistan.
UK troops ceased combat operations in 2014 and most of those who remained, primarily to help train the Afghan army, left last month.
The government has agreed to resettle up to 20,000 Afghan refugees displaced by the return of the Taliban over the next few years.
Efforts are also continuing to evacuate UK nationals from Kabul airport, but Downing Street did not deny a report that one plane had taken off "almost empty".
Parliament was recalled from its summer break for the seven-and-half-hour debate on the situation in Afghanistan.
Mrs May called Nato's withdrawal "a major setback for British foreign policy".
She said it was "incomprehensible and worrying" that the UK government had not been able to put together an "alternative alliance of countries" to continue to support the Afghan government in the absence of US forces.
Another Conservative MP and former soldier, defence committee chairman Tobias Ellwood, argued the UK "should never have left" Afghanistan.
"What we require is the backbone, the courage, the leadership to step forward, yet when our moment comes such as this we are found wanting," he said.
Mr Mercer, who served in Afghanistan and who quit as veterans' minister earlier this year, accused Mr Johnson of "consistently failing" to support ex-soldiers.
This was the first full in-person session in the House of Commons for over a year and Boris Johnson felt the full force of it.
He had to battle through parts of his opening statement on the crisis in Afghanistan, in a noisy chamber, as MPs from all sides vied to intervene.
It was a striking contrast to the often flat proceedings that have been a hallmark of the part-virtual Parliament over the past year.
Now, lined up on the front bench, Mr Johnson and his ministers not only had to hear the searing criticisms from colleagues but look them in the eye as well, whether in the chamber or in backrooms, corridors and passages.
Some 457 UK personnel have died and more than 2,000 have been wounded in Afghanistan since the invasion, prompted by the 11 September 2001 attacks on the US by al-Qaeda.
Mr Johnson said that "in spite of all the difficulties and challenges we knew we would face... we succeeded in that core mission" of removing the terror group's operatives from Afghanistan.
"It would be fair to say [recent] events in Afghanistan have unfolded and the collapse [of the Afghan government] has been faster than even the Taliban themselves predicated," he said.
"What is not true is to say the UK government was unprepared or did not foresee this."
Mr Johnson said the Taliban, who have promised to observe human rights, must be judged on "actions rather than words".
"At this bleak turning point we must help the people of Afghanistan determine the best of all possible futures," he added.
But opposition leader Sir Keir Starmer accused the prime minister of "staggering complacency" and "appalling" judgement by failing to plan properly for the withdrawal of troops over the past 18 months.
He called the government's refugee repatriation target too small and claimed the 20,000 figure had been "plucked out of the air".
To jeers from Conservative MPs, he said: "The prime minister's response to the Taliban arriving at the gates of Kabul was to go on holiday."
Mr Johnson received little backbench support during the debate, but Conservative Alicia Kearns said the government had "called for Nato allies to help us build a new coalition in Afghanistan to prevent the Taliban recapturing it, and we were let down".
Fellow Tory Caroline Nokes praised the prime minister for putting in place a scheme to "ensure that we can prioritise women and girls" in Afghanistan "and bring them to safety".
But SNP Westminster leader Ian Blackford argued that the future of Afghanistan had "never been so uncertain" and that refugees needed more help.
Liberal Democrat leader Sir Ed Davey branded the prime minister a "national liability" who could not "escape culpability for this disaster".