If the government (let's say in the US or EU) prohibit businesses engaging in an otherwise legally compliant enterprise, do it need to compensate the business owners for that? Assuming that's for example extreme weather, an imminent war or the 2020 pandemic, and assuming they do not single out concrete businesses, that is, they close entire sectors (all restaurants not only Bob's Diner). Would that be analogous to the Fifth Amendment of the US Constitution (if the government takes private property for public use, it must provide "just compensation.")?
Always assuming that the government has operated within the limits of its powers or, at least, that if they have exceeded those powers the excess was in good faith.
First, there is the issue of sovereign immunity. Basically, a government can be held liable only when it consents to be held liable. Most governments never waive this with respect to their lawmaking powers because they have to be able to make laws in what they see as the public interest without fear of litigation. See, for example, cases on plain paper packaging of cigarettes.
Second, most governments have the power to regulate commerce and to deal with public emergencies. There is an issue which comes up in Federations about which government has the power but even if a law is invalid, it does not follow that compensation is payable. It certainly isn’t if the law is valid.
This will depend on the details of the constitution. Generally, governments reserve sweeping powers for use in emergencies, often without automatic compensation.
In Germany, one of the EU countries you mentioned, the legal remedy for someone who feels unjustly singled out by a lockdown measure is to file a lawsuit against the measure, not to send a bill for the economic losses. At the same time, the government did decide to pay some compensation for some losses, but that was something between welfare and economic stimulus.
This answer is as to the U.S. only. The framework of public law (i.e. the rights of people v. the government) is very different in some E.U. countries from the U.S.
For example, French legal rules regarding when government action gives rise to a right to compensation are much more generous than in the U.S.
If the government (let's say in the US . . . ) prohibit businesses engaging in an otherwise legally compliant enterprise, do it need to compensate the business owners for that? Assuming that's for example extreme weather, an imminent war or the 2020 pandemic, and assuming they do not single out concrete businesses, that is, they close entire sectors (all restaurants not only Bob's Diner).
There is a "police power" exception to the takings clause.
For example, in the case of Lech v. Jackson (10th Circ. October 29, 2019), the court summarized its own opinion as follows in a case where police trashed his townhouse beyond repair in pursuit of a minor property crime offender:
Leo, Alfonsia, and John Lech (the Lechs) sued the City of Greenwood Village (the City) and several of its police officers (the officers), alleging violations of the Takings Clause of the Fifth Amendment of the United States Constitution and Article II, Section 15 of the Colorado Constitution. In support of their Takings Clause claims, the Lechs alleged the defendants violated their constitutional rights—first by damaging the Lechs’ Colorado home during an attempt to apprehend a criminal suspect and later by refusing to compensate the Lechs for this alleged taking. The district court granted the defendants’ motion for summary judgment, concluding in relevant part that (1) when a state acts pursuant to its police power, rather than the power of eminent domain, its actions do not constitute a taking; (2) because the officers destroyed the Lechs’ home while attempting to enforce the state’s criminal laws, they acted pursuant to the state’s police power; and (3) any damage to the Lechs’ home therefore fell outside the ambit of the Takings Clause.
This rule also applies in the circumstances you have described, all of which fall within the police power exception to the takings clause.
Also, while a 5th Amendment "taking" does not necessarily always require that the public obtain what the person who owned the property gave up, for use for a public purposes, the heartland of 5th Amendment cases involve the fact pattern of the government taking property from an individual for its own use (usually real estate and associated fixtures or buildings). In contrast, most "police power" exception cases do not involve this fact pattern. This is a useful rule of thumb to provide a starting point before you make a more detailed analysis of the existence of a taking's clause claim.
Another key rule is that only a "total taking" that deprives the owner of all economic value of the property can be a taking, even if the regulation or public use reduces the value of a person's property. This rule is commonly used to defeat claims of a "regulatory taking" whereby a new land use or other regulation reduces the value of property without eliminating it, for example, in the case of a downzoning, or a total ban no the form of land use that was previous the highest and best use of the property.
Background for how eminent domain law evolved over the course of the 19th century can be found in this recent law review article (the citation is to a blog citation and restatement of the abstract, in case the article itself is closed access).