The movie is Krull. (1983)
The planet Krull is invaded by an entity known as the "Beast" and his army. Prince Colwyn and Princess Lyssa plan to marry in the hope that their combined forces can defeat the Beast. The Beast’s army attacks the wedding before it is finished and kidnaps the princess, leaving Colwyn and the entire kingdom for dead.
Prince Colwyn is found and nursed by Ynyr, the Old One. Ynyr tells him the Beast can be defeated with the "Glaive", a five-pointed throwing weapon. Colwyn sets out to track down the prison where the Lyssa is being held, the Black Fortress, which teleports to a new location every day at sunrise. As they travel, Colwyn and Inyr are joined by magician Ergo, a band of nine thieves, and a cyclops.
They travel to find a wizard who can tell them where the castle will be the next day but he is defeated magically by the Beast before he can.
In a last ditch attempt to find the fortress, Ynyr leaves the group to journey to the "Widow of the Web", an enchantress who loved him long ago and was exiled to the lair of the Crystal Spider for murdering their only child. The Widow reveals where the Black Fortress will be at sunrise. She also gives Ynyr the sand from the enchanted hourglass that kept the Crystal Spider from attacking her and will keep a badly injured Ynyr alive on his journey back to the group. As the Crystal Spider attacks the Widow, Ynyr flees the web and returns to the group to reveal the location of the Black Fortress, as he loses the last of the sand and expires.
The group capture and ride mystical flying Fire Mares (which look like Clydesdale stallions with fiery hooves) to reach the Black Fortress before it teleports again, and enter the castle before it disappears. Colwyn attacks, but does not kill, the Beast with the Glaive, losing the Glaive forever. They royal couple quickly complete the wedding, releasing the their linked power, and they defeat the Beast with fire.
Condensed from: Wikipedia