Lower courts had deemed the ban unconstitutional, but the US top court has reversed this decision in a 5-4 ruling announced on Tuesday.
The ban prohibits most people from Iran, Libya, Somalia, Syria and Yemen from entering the US.
It has been criticised by refugee and human rights groups.
President Donald Trump’s ban has seen several iterations.
Iraq and Chad had been on previous versions, but have since been removed.
The administration says that the countries on the ban “remain deficient at this time with respect to their identity-management and information-sharing capabilities, protocols, and practices. In some cases, these countries also have a significant terrorist presence within their territory”.
The state of Hawaii had challenged the ban and a federal judge blocked its implementation.