Edinburgh University said two of the students, who were studying in the capital Cairo, had been detained by authorities.
The pair have since been released but the university advised all of its students in the country to return home.
All nine students studying in Egypt have either now returned or are currently heading back to Scotland.
A spokesman for the university said: “The university is obviously very concerned when it hears of incidents such as this, particularly when they involve our own students.
“We have a responsibility to act in the best interests of our students and to take decisive action when there are concerns for their safety and wellbeing.
“We therefore required all nine of our students in Egypt to leave the country. All students have now left Egypt or are in the process of doing so.”
The students were spread between the American University of Cairo and the city’s International Language Institute, undertaking Arabic degree programmes.
The spokesman added: “We are working closely with the students to minimise the impact of any disruption to their studies and to provide alternative placements.”
Following anti-government protests in Egypt last month, several foreign nationals have been detained, released and deported amid a crackdown by the authorities involving more than 2,900 arrests.