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.
Parental rights in the UK
- Women are entitled to up to 52 weeks' maternity leave
- They must take at least two weeks' leave after the baby is born (or four weeks if they work in a factory)
- They are eligible to be paid for six weeks at 90% of their average weekly earnings and 33 weeks at £151 per week or 90% of their average weekly earnings (if lower)
- Fathers can take two weeks' statutory paternity leave at up to £151 a week
- Some couples are also entitled to shared parental leave of up to 50 weeks and 37 weeks of pay
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".