The Christian Democratic Union (CDU) and the Social Democrats (SPD) came to an agreement over the gender quota as part of the coalition negotiations to form Germany’s next government.
Members of the family working group reached the decision late on Sunday evening, also agreeing that companies must publish targets for the increase in the proportion of female directors on the board and in top management positions from 2015.
"I am pleased that we have come to a reasonable agreement with the SPD in favour of women," CDU chief negotiator Annette Widmann-Mauz said on Sunday.
Germany's first female leader, Merkel, 59, had long-opposed the introduction of a compulsory women's quota in company boardrooms.
In April, Merkel's government defeated an opposition bid in parliament to set a quota for female board members with the motion defeated by 320 votes to 277.
However, following negotiations, Widmann-Mauz said the compromise would lead to "a cultural change within companies".
Women are currently a minority on supervisory and boards of directors at major German companies. Just 11.7 percent of the boards are made up of women, 12 years after industry committed to appointing more to those positions.
SPD chief negotiator and party deputy Manuela Schwesig said the quota agreement was an important step towards improving career prospects for women and promoting quality in the labour market.
The working group also agreed to proposals for a legal claim to 10-day family care leave and a "parental allowance plus", which would allow parents to claim parental benefits in combination with a part-time job for up to 28 months to help them back into work.
However, the group could not come to a decision over care benefits and the issue of adoption rights for homosexual couples.
The working group decisions are due to be discussed by the wider coalition groups on Tuesday.