Conservative MP Michael Ellis is to fill in as Attorney General while Suella Braverman goes on maternity leave, the government has announced.
Ms Braverman is taking six months off for the birth of her second child.
The law has been changed so cabinet ministers receive paid maternity leave – they were previously expected to resign their posts.
Prime Minister Boris Johnson gave Ms Braverman, who is due to return to work in the autumn, his “best wishes”.
Several female politicians serving as junior, rather than cabinet, ministers have taken maternity leave in the past, including Conservative MPs Tracey Crouch and Kemi Badenoch.
Mr Ellis has been solicitor general – who deputises for the attorney general – since 2019.
He will be replaced by Lucy Frazer, currently a justice minister. She previously served as solicitor general for two months during 2019.
The Ministerial and Maternity Allowances Bill – brought in to enable Ms Braverman and other cabinet ministers to take leave – entered law on Monday.
There was a slight hold-up last week, when the House of Lords objected to the description of pregnant women as “persons” in the government’s legislation.
But ministers later agreed that they could be officially known as “mothers”.