Moscow says the sailors violated its maritime border near the peninsula which it seized from Ukraine in 2014.
But the International Tribunal for the Law of the Sea sided with Ukraine in the dispute, which has stoked tensions between the nations.
Russia, however, refuses to recognise the jurisdiction of the body.
It boycotted the hearings and analysts say the chances of it abiding by the Germany-based tribunal's provisional ruling appear minimal.
The Ukrainian vessels had tried to pass through the Kerch Strait, the only access to Ukrainian ports on the Sea of Azov.
But Russia has controlled the Strait since annexing Crimea, and its coastguard boats fired on the vessels before boarding them.
Russia has held the sailors in Moscow ever since.
But, in a ruling, the tribunal's Judge Jin-Hyuan Paik said: "The Russian Federation must proceed immediately to release the Ukrainian soldiers and allow them to return to the Ukraine."
However, while the tribunal said both sides should refrain from any action which would aggravate the dispute, it did not uphold Ukraine's request for Russia to suspend the trial of its servicemen.
The sailors face up to six years in jail if found guilty.
Ukraine's new president, Volodymyr Zelensky, said during his swearing-in on Monday that ending the conflict with Russian-backed rebels in the east will be his top priority.
Fighting in the region has claimed about 13,000 lives since 2014.