Yes, refugees can lose their status wherever their country of origin becomes safe again and their claim to asylum ceases to be valid. Theoretically, they can even be deported, although the authorities of the host country will often try to organise some sort of semi-voluntary return programme instead and many people will also simply remain illegally.
It has happened before and since you mention Germany, one prominent example would be refugees from (ex-)Yugoslavia and in particular from Bosnia-Herzegovina. In 1997-1999, tens of thousands of them had to leave Germany. The federal government even named Hans Koschnik commissioner for “the return of refugees, reintegration and return-facilitating reconstruction in Bosnia and Herzegovina”. Among former refugees, some people were also granted a special right to stay in Germany based on the trauma they experienced in their country of origin and a few tens of thousands emigrated elsewhere (like the US, Canada, etc.) According to this book only about 6000 people were actually removed against their will (abgeschoben). The number of people from Bosnia recognized as refugee went down from 345000 in 1996 to 30000 in 2000.
You also have to realise that deporting someone is complicated and expensive so that it's simply not possible to remove everybody immediately. In many cases, when tens of thousands of people lose their claim to residency at once, they just stay put illegally until they find another solution or decide to leave of their own accord (to some extent that's comparable to the sans-papier situation in France, most sans-papiers have never been refugees but they did usually enter legally, e.g. as a student, and find themselves staying illegally later).
To give a specific example, still according to the same book, in 2000, about 140 000 Kosovo-Albanians were under an obligation to leave Germany (ausreisepflichtig) but only 2000 were deported in that year (mostly because they were criminals). And some people are still being deported to Kosovo today, some of them would have entered legally or illegally in the meantime but others are still in Germany 10-15 years later.
In France, the path to citizenship is generally easier and the refugee pool is more diverse, I am not aware of any large scale return programme like that. In practice, most people who stay legally in the country, learn the language and don't do something stupid (like being convicted of a crime) qualify for long-term residence or citizenship reasonably quickly.