After Genie saves Aladdin, he frees Carpet, Jasmine, Abu, and the Sultan. When he gets all four onto a roof of one of the palace towers, the Sultan's turban has reappeared after Jafar stole and slashed it earlier. Apparently, Genie restores it with his powers when he frees the others.