If a company's earnings keep rising and the stock price keeps falling because of other factors such as lawsuits, tariffs etc., is there any guarantee that the price will rise eventually? When does this correction usually happen and how long would it take?
is there any guarantee that the price will rise eventually?
Absolutely not. There is no guarantee of anything in the business world.
A stock's price should be based on future expectation of earnings (real cash earnings, not just "accounting" earnings), not past earnings. So even if a company posts earnings growth in the past, things like tariffs and lawsuits as mentioned in your question can certainly reduce future earning potential.
Firstly guarantee is a strong word; you should think of the market price of a stock as an offer to sell. Rationally speaking if the value is less than the price you should not buy and if the value is more than price you should buy. There some basis in fundamentals for the price, but it is mostly psychology.
If you can speculate the lawsuits, tariffs and the like to blow over then you can speculate that it is possible to likely the price will recover eventually, though this may be a long time or the company may go bankrupt in that time. To quote Keynes: "Markets can remain irrational longer than you can remain solvent."
Theoretically, a price includes current expectations. The price would only rise if the performance of the company, in some respect, exceeds current expectations. It's entirely possible that the rise in future earnings and perhaps even a decrease in lawsuits and tariffs is already priced in and so when the expected happens, the price will not change significantly. You can even have an increase in earnings and still see the price drop if the increase in earnings was less than expected.