Prior to applying for maternity benefit, a woman needs to work for at least 80 days. If this criteria is fulfilled, then she is entitled to the benefit.
There is no law that she needs to announce her pregnancy at the time of joining, unless her job explicitly demands so. And even in that case, it will be the responsibility of the company to put her through medical test in order to determine her medical condition including pregnancy.