Addressing the state banquet gathering held at Germany's President Joachim Gauck's residence, the Bellevue Palace, the 89-year-old Queen said: "In our lives, Mr President, we have seen the worst but also the best of our continent.
"We have witnessed how quickly things can change for the better. But we know that we must work hard to maintain the benefits of the post-war world.
"We know that division in Europe is dangerous and that we must guard against it in the West as well as in the East of our continent. That remains a common endeavour."
The Queen's comments come as David Cameron is set to meet EU leaders in Brussels on 25 June.
Cameron is hoping Germany's Angela Merkel who is often referred to as Europe's "summit queen" will help him with his renegotiation efforts.
Both Cameron and Merkel were present at the banquet during the Queen's speech.
Meanwhile, the German President said, reported Sky News: "We know that we need an effective European Union based on a stable foundation of shared values.
"A constructive dialogue on the reforms Britain wants to see is therefore essential. As a good partner, Germany will support this dialogue. For Britain is part of Europe. The European Union needs Britain.
"A united Europe, a strong European Union, represents stability, peace and freedom - for us all."
The Queen is to remain in Germany until 26 June and will also visit the site of the Bergen-Belsen Nazi concentration camp. The camp was liberated by British forces on 13 April 1945.
The royal couple will also visit the memorial in the camp dedicated to Anne Frank, whose diary detailing the family's years spent in hiding in Amsterdam during the Nazi occupation was published after the war.