The global organization's comments come after the arrest of German captain Carola Rackete. The 31-year-old contravened Italian law by docking with 42 rescued passengers last week.
The United Nations criticized Italy on Monday for its hostility towards refugee rescue ships. The comments came amid raised tensions between Berlin and Rome regarding the detention of German Sea Watch captain Carola Rackete.
UK spokeswoman Stephane Dujarric said in a daily press briefing that "no vessel or ship master should be at risk of being fined for coming to the aid of boats in distress, where loss of life is imminent."
"Sea rescue is a longstanding humanitarian imperative. It's also an obligation under international law."
The captain of the Sea-Watch 3 was put under house arrest at the weekend after she forced her vessel into the Italian port of Lampedusa, citing the welfare of a number of refugees she had rescued.
Dujarric, the spokesperson for Secretary General Antonio Gutteres, said that the UN was "concerned by the recent decree from the government regarding NGO vessels."
She was referring to Italian Interior Minister Matteo Salvini's successful implementation of legislation to fine ships that flout orders to stay out of Italian waters. The range of fines varies from €10,000 to €50,000 ($11,360 to $56,800). There is also the possibility of criminal action against the crew, as well as the confiscation of the vessel.
On Tuesday, Rackete defended her actions when she appeared in an Italian court, saying that the situation on board had been "very tense," the captain's lawyer told news agency DPA. A decision on her possible release is expected later in the day.
Germany calls for captain's freedom
The UN announcement came in the wake of the German foreign office pleading with Italian officials to set Rackete free.
"We refuse to allow sea rescue to be criminalized. In our view, the only feasible outcome of current proceedings under the rule of law can be the release of Carola Rackete," Foreign Minister Heiko Maas said.
He added: "Haggling over refugee distribution is undignified and must stop. We urgently need a European solution — one that is also in line with our European values."
But Salvini called Rackete "the German criminal," and has previously described the right to defend Italian borders as "sacred."
German and Italian officials appeared to be at loggerheads as Germany's European Commissioner Guenther Oettinger, who told broadcaster ZDF: "I don't care about Salvini's assessment. As a citizen of Europe, I have full understanding for this woman, who acted bravely, in my view. And I have confidence in Italian justice."
"This is not about an isolated incident. This is about finding a solution in Europe at last regarding how we deal with refugees."