The International Maritime Organization is working to evacuate hundreds of ships stuck in the Persian Gulf since the Middle East conflict broke out, said its secretary-general.