A Turkish court has ordered the release of journalist Fatih Altayli from prison while he appeals his conviction for allegedly threatening President Recep Tayyip Erdogan.