The judges ruled with five to four votes for the restrictions issued by President Donald Trump, reported the German news agency dpa.
In this case, it was about entry barriers for citizens from Iran, Libya, Somalia, Syria and Yemen. The non-Muslim countries North Korea and Venezuela would also be affected by the US government measure. The visa bans were issued in September 2017.
Allegations that the US government is discriminating against people on the grounds of their religion have now been rejected by the judges. The entry ban relates to national security and is legal it ruled.
Trump had announced a harsher immigration policy during the election campaign. A few weeks after his election victory on January 20, 2017, he issued a first entry ban against predominantly Islamic countries.
This procedure had initially been stopped in courts.