Hamaseh Tayari, who holds an Iranian passport, was due to fly back to the city via New York on Saturday following a holiday in the Central American country.
She was prevented from doing so by the executive order signed by Mr Trump that imposed a 90-day ban on entry to the US for nationals from Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen.
Ms Tayari, who grew up in Italy, is a postgraduate veterinary student at the University of Glasgow.
A spokesman for the university said: “We were extremely concerned at the difficulties which one of our postgraduate students encountered on trying to return to the UK via the United States after holidaying in Costa Rica.
“We have been in touch with Hamaseh who has made arrangements to get back to Glasgow via an alternative route. The University will do all that we can to support her.”
It is hoped that she will be able to return to Scotland on Tuesday.
More than £4,500 has been raised to cover Ms Tayari’s travel costs through a crowdfunding page set up Kathleen Caskie from the Women for Independence organisation.
She said the donations would help replace the “huge amount of money” the diversion had cost and would “stick two fingers up to Trump and help out Hamaseh as a gesture of solidarity.”
Any money left over will be donated to the Scottish Refugee Council in “further protest against Trump’s policies”.
Earlier Ms Tayari told the Guardian newspaper: “This has really shocked me. We just discovered (what Trump did) at the airport when we went to check in.
“I want people to know that this is not just happening to refugees. I am a graduate and I have a PhD. It has happened to a person who is working and who pays tax.
‘’We had been saving for months for this holiday and it will cost me a month’s salary just to get home.
“I am destroyed. I did not know that I could cry for so long. It feels like the beginning of the end. How this is possible? I am really afraid about what is going on.”
Mr Trump’s order barred all refugees from entering the US for four months, and indefinitely halted any from Syria. He said the ban was needed to keep out ‘’radical Islamic terrorists’’.
The move immediately suspended a programme that last year resettled in the US about 85,000 people displaced by war, political oppression, hunger and religious prejudice.
Downing Street said on Sunday morning that Prime Minister Theresa May does “not agree” with Mr Trump’s refugee ban and would make representations if it affected Britons.
Scottish politicians have taken to Twitter to express their views on the issue.
Scottish Tory leader Ruth Davidson tweeted: “Back from Copeland to read the news of the US ban on migrants from Muslim countries. Both wrong in itself and very worrying for the future.”
First Minister Nicola Sturgeon tweeted: “Scotland & US have deep friendship built on values. We must all speak up for those values - tolerance, equality & refuge for those in need.”
Responding to Ms May’s statement she added: “The PM should have said this the first time she was asked, not hours later and only under pressure.”