Not just the Good Friday Agreement, but now also the Benn Act makes leaving without a deal on 31st October, without the refusal of the EU to grant an extension, illegal.
The question of if that would make it invalid is less clear. A court could possibly rule that due to the breech of the law it was invalid and therefore should be considered to have not happened, similarly to how the recent proroguing of Parliament was undone. However, this is mere speculation and complicated by the fact that the EU may consider the UK to have left after the 31st of October even if the UK doesn't.
In practice I think it is unlike to come to this, as any legal action would likely be concluded before October 31st and if leaving without a deal was considered unlawful the remedy would be to either seek an extension from the EU or withdraw Article 50 before that date.