The legality of laying off an employee returning from maternity leave largely depends on the labor laws of the country. In India, the Maternity Benefit Act, 1961, protects the employment of women during the time of her maternity and provides for maternity benefit and certain other benefits.
According to the Act, it is unlawful to discharge or dismiss a woman during her absence or pregnancy on account of her maternity leave. If the woman is dismissed on account of any gross misconduct, the employer must provide a written reason for the same.
However, if the company is facing genuine financial difficulties and needs to lay off employees, it should be done in a non-discriminatory manner. That means you cannot single out the employee returning from maternity leave. If layoffs are necessary, they should be done based on factors such as performance, seniority, or other non-discriminatory reasons.
It's highly recommended to consult with a legal expert or labor law consultant before making any decisions. This will ensure you're in compliance with all relevant laws and regulations, and help you avoid potential legal complications.