Having been wrecked during the initial storm, the boat is stowed away from Alonso and his men who have been dispersed around the island. As part of the resolution of the play in Act 5, the ship is restored to Alonso after his Boatswain discovers it "tight and yare and bravely rigg'd", in other words, as new.
Ariel has worked this magic, because to restore the ship to Alonso is a symbol, not only of Prospero's power (through Ariel), but also of his new found humanity, and forgiveness; he restores the ship to Alonso so that he can return home safely.
The ship comes ashore to the island because Propspero discoveres that they are nearby and creates the tempest to wash them ashore. In the end, after thinking his ship was gone, The King is shocked to see his ship in the harbor.