South Africa has appealed to the UN High Court to order a ceasefire in Gaza to save civilians in Rafah.