Israeli Defence Force (IDF) soldiers have broken a decades-long hiatus, marking a historic moment as they prayed at the ancient synagogue in Gaza.