British forces were first deployed to Afghanistan in 2001 following the 9/11 attacks on the United States and played a major role in combat operations until 2014. A total of 457 British soldiers were killed in the country.
"All British troops assigned to NATO's mission in Afghanistan are now returning home," Johnson said in a statement to parliament.
"For obvious reasons, I will not disclose the timetable of our departure, though I can tell the house (parliament) that most of our personnel have already left."
Violence has been raging throughout Afghanistan in the weeks since President Joe Biden announced troops would withdraw unconditionally by Sept. 11.
The United States last week abandoned Bagram air base, the longtime staging ground for U.S. military operations in the country, effectively ending America’s longest war. The Pentagon says the withdrawal of U.S. forces is 90% complete.
Johnson outlined the change to Britain's presence in Afghanistan, saying he did not underestimate the challenges facing the country and the government would continue to provide development assistance.
"I hope no one will leap to the false conclusion that the withdrawal of our forces somehow means the end of Britain's commitment to Afghanistan, we are not about to turn away, nor are we under any illusions about the perils of today situation and what might lie ahead," Johnson told parliament.
More about: UK Boris-Johnson Afghanistan