Check the contract - many will have that if you resign while on Maternity Leave you have to pay back all the money they paid you, as it was paid in good faith that you would return.

It may be worth returning then resigning after the "good faith" period is up if you cannot afford to repay your maternity leave wages.