Every company is different. You need to check your employment contract.
The company I'm working for has 4 weeks of maternity leave, and 12 months unpaid maternity leave. The condition is you need to be in the company at least 12 months.
So I only took 4 weeks leave, then went back to work afterwards.