Normally, any working individual in an organization has to inform well in advance (give notice period) for the management to find a suitable replacement smoothly. In your case, you plan to resign post-maternity leave. Hence, why not inform them well in advance so that there will be no hassles in relieving you? Also, since you are on maternity leave, somebody would be looking after your responsibilities, right? The management may have to ask the concerned individuals to extend their roles a little further. It's good business ethics if you follow the norms while you are on the job. Also, you may not like this to happen to you (i.e., suppose you are an employer, would you like your employee to adopt your method of resigning post-maternity). Hence, think about both sides of the coin before arriving at a decision. As far as your query is concerned, no company law is above the law of the land.
Best wishes.