US President Donald Trump had urged authorities to rethink their decision, AP news agency said.
A US travel ban is in place for six Muslim-majority countries, which does not include Afghanistan.
Students from The Gambia earlier also had their visa rejection overturned.
According to AP, Homeland Security Department spokesman David Lapan said the visas for the Afghan girls had been approved after a request by the state department.
White House spokeswoman Sarah Huckabee Sanders attributed the request to an intervention by President Trump, the news agency said.
The competition organised by non-profit group First Global will see teams from 164 countries compete in a series of robotic games.
"I am most grateful to the US Government and its state department for ensuring Afghanistan, as well as Gambia, would be able to join us for this international competition this year," First Global president Joe Sestak said in a statement.
The Afghan team of six teenage high school students are participating in the competition which runs 16-18 July with a ball-sorting robot.
First Global aims to promote Stem subjects (science, technology, engineering and maths).
"All 163 teams from 157 countries have gained approval to the United States, including Iran, Sudan, and a team of Syrian refugees," Mr Sestak said. "I could not be more proud."