Qatar offered no explanation for the move, though it comes amid a diplomatic dispute with other Arab nations that have cut diplomatic ties and now are trying to isolate Qatar from the rest of the world.
While the dispute hasn't escalated to a military confrontation, Qatar's military is dwarfed by neighboring Saudi Arabia and the United Arab Emirates, two of its biggest opponents in the crisis.
The 450 Qatari troops controlled a mountainous border crossing between Eritrea and Djibouti, said Nasredin Ali, a spokesman for Eritrea's biggest armed group, known as the Red Sea Afar Democratic Organization. Eritrean forces moved in after the troops departed, Ali said.
Eritrea's top diplomat to the African Union, Araya Desta, told The Associated Press the move came after Eritrea cut diplomatic ties to Qatar. However, Desta said his country wanted no confrontation with Djibouti.
"We don't want to take any of Djibouti's land," Araya said. "The last time we had some skirmishes. It was unnecessary."
Doha mediated the conflict between the two countries in 2010. Gulf nations have stationed troops in both African countries, using that as a jumping-off point for the ongoing Saudi-led war in Yemen.
Saudi Arabia, Egypt, the United Arab Emirates and Bahrain have accused Qatar of supporting terrorism and severed ties with Doha last week. Qatar denies the allegations, but its ties to Iran and embrace of various Islamist groups have put the country under intense scrutiny.
In Geneva, the United Nations human rights chief said Wednesday he is "alarmed about the possible impact" of a diplomatic rift in the Persian Gulf on people's lives.
"It is becoming clear that the measures being adopted are overly broad in scope and implementation, and have the potential to seriously disrupt the lives of thousands of women, children and men," said Zeid Ra'ad al-Hussein.
After cutting ties with Qatar, Saudi Arabia, the UAE and Bahrain also ordered Qatari residents out though on Sunday, officials said there would be exceptions for mixed-nationality families.
Al-Hussein said these measures do not sufficiently address all cases and expressed alarm that the UAE and Bahrain have threatened to jail and fine people who express sympathy for Qatar online.
Bahrain's public prosecutor said Wednesday a citizen was detained for questioning over expressions of criticism at the country's stance toward Qatar.
Also Wednesday, Saudi Arabia blocked access to Qatar's state TV website in the latest move by the kingdom to isolate the tiny Gulf country. The kingdom said the website was blocked because it violates the rules of the Ministry of Culture and Information.
Saudi Arabia, the UAE and Bahrain have also barred new subscriptions and imports of satellite decoders for the Qatari-owned beIN Media Group, which includes sports and movie channels.
The three countries, along with Egypt, have already blocked access to Qatar's Al Jazeera Arabic news channel and its affiliate websites. Saudi Arabia has also revoked Al Jazeera's operating license.
Meanwhile, top donors trying to relieve the humanitarian crisis engulfing war-torn Syria met in Doha on Wednesday. Countries have pledged $6 billion to help Syria, but so far only 22 percent of that has been funded, said Marcy Vigoda of the U.N. Office for the Coordination of Humanitarian Affairs.
I'm "taking this opportunity to request this top donor group to use your leverage, to use your influence ... to ensure that pledges are turned into commitments," Vigoda said.
The Associated Press.