The statement will be welcomed by the British government, which has made a series of warnings about the domestic cost of leaving the bloc at a June 23 referendum on EU membership.
"A UK exit from the EU would reverse the trend towards greater global trade and investment, and the jobs they create, and is a further serious risk to growth," G7 leaders said, in the only reference to the vote in a 32-page declaration.
Brexit was listed alongside geopolitical conflicts, terrorism and refugee flows as a potential shock of a "non-economic origin".
The issue was not formally on the agenda at the two-day summit in Japan, but British government officials had said they expected it would come up on the margins.
Merkel said on Friday that leaders had not discussed Brexit but that there was a consensus that they wanted the country to stay in.
"It was no subject here. But there was the signal that all who sat here want Britain to stay part of the EU," Merkel told reporters on the sidelines of the summit. "But the decision is up to the British voters."
Opinion polls have given conflicting steers on which way the vote might go, with telephone polls suggesting "In" is comfortably ahead while online polls suggest a tight race that "Out" could win. Betting odds heavily favour an "In" vote.
The G7 statement follows comments from the International Monetary Fund that there were no economic positives to Britain leaving the EU, while the Bank of England has said the economy would slow sharply, and possibly even enter a brief recession.
The Organisation for Economic Co-operation and Development has also warned that British voters risk paying a "Brexit tax" equivalent to a month's salary by 2020 if they leave the EU.
Last week, G7 finance leaders united in wishing Britain stayed in the EU, but acknowledged they could do little more than hope.