Is it possible under international law for a country to legally acquire territory belonging to another sovereign country by force? What are the preconditions for this action to be legal? Is it just a case of whether the annexation has enough international recognization?
I guess you are not talking in hypotheticals here, right? Is this about Israel?
All international law is either customary or being agreed by the nations, and nations get to agree what counts as customary international law. So a sufficient number of sufficiently significant nations agreeing to the annexation would do it.
There used to be the concept in international law that annexation after conquest was legitimate, especially if the conquest resulted from a war deemed legitimate. The idea was roughly that kings owned their territory (including the allegiance of the population) and could leave it to their heirs, or trade it away, or fight for it.
This has been replaced by the self-determination of nations, which implies that occupation can be a wartime expedient but not permanent. But this was not completely retroactive. The conquest of Gibraltar in 1704 is still considered valid today. Of course there is the question what a nation is. Many Catalans think they are a nation deserving self-determination, while much of the world considers them part of Spain.