The sailors and their three vessels were taken by the Russian navy last November. The incident marked a major escalation in tensions between the two former Soviet Republics.
Ukraine said two of its small gunboats and one tugboat were attacked after entering the Kerch Strait en route to the city of Mariupol. Russia said the Ukrainian ships illegally entered Russia's territorial waters, carrying out dangerous maneuvers.
The UN International Tribunal for the Law of the Sea said Russia must release the sailors immediately and urged both nations to not escalate the conflict.
"The actions taken by the Russian Federation could irreparably prejudice the rights claimed by Ukraine to the immunity of its naval vessels and their servicemen," said Jin-Hyun Paik, the tribunal's president.
Ukraine has asked for the sailors' release, but Russia has not yet taken notice of the country's requests or attended public hearings on the case, the tribunal said.
Ukrainian Deputy Foreign Minister Olena Zerkal said she expects Russian authorities to comply with the tribunal's order.
"The order of the Tribunal is a clear signal for Russia that it cannot violate international law with impunity," she said, according to Ukrainian state-run news agency Ukrinform.
Russian officials did not attend the tribunal's hearing and only sent a note through the Russian Embassy in Germany saying the country does not believe the tribunal has jurisdiction to review the incident, Russian state-run news agency TASS reported.
The Kerch Strait — a shallow, narrow stretch of water just 2 to 3 miles wide at one point — connects the Azov Sea with the Black Sea and runs between the Crimean Peninsula and Russia. It is an important economic lifeline for Ukraine, as it allows its ships to access the Black Sea.
It's also the closest point of access for Russia to Crimea, a peninsula Moscow annexed from Ukraine in 2014. A Russian-built bridge over the Kerch Strait opened last year.
Russia and Ukraine have been locked in long-simmering conflict since the annexation of Crimea, and a war with Russian-backed separatists in the country's east has claimed more than 10,000 lives. Russia has also backed separatists in Ukraine's eastern Donbas region.