The entropy of $N$ molecules of an ideal gas in a volume $V$ at temperature $T$ can be expressed as:
$$S(N, V, T) = N k\log\left(\frac{V}{V_0}\right) + C_v\log\left(\frac{T}{T_0}\right) + S(N, V_0,T_0)$$
Here $V_0$ and $T_0$ define arbitrary standard conditions at which the entropy is known, and $C_v$ is the total heat capacity at constant volume. To derive this formula, you can consider the change in entropy from the standard conditions to the final state using an isothermal process at constant pressure where heat is added to the system, thus yields the first term. After that we can change the temperature from $T_0$ to $T$ by adding heat to the system at constant volume, the entropy change due to that process is given by the second term.
The initial entropy of the system can thus be expressed as:
$$S_{\text{initial}} = S(N,V_1,T_i) + S(N,V_2,T_i) = N k\log\left(\frac{V_1V_2}{V_0^2}\right) + 2C_v\log\left(\frac{T_i}{T_0}\right) + K$$
where $K$ is a constant (for problems where the total number of molecules in the system does not change). The final state will be a state where the molecules are (or can be considered to be) in a volume of $V_1 + V_2$ at some temperature $T_f$. If no work can be extracted anymore the gases in the two boxes must be in thermal equilibrium with each other and then doesn't matter whether or not there is a separation between the gases. The final entropy is thus given by:
$$S_{\text{final}} = S(2N,V_1+V_2,T_f) = 2N k\log\left(\frac{V_1+V_2}{V_0}\right) + 2C_v\log\left(\frac{T_f}{T_0}\right) + K$$
Then for any process involving only the two boxes, $S_{\text{final}}\geq S_{\text{initial}}$. The maximum amount of work we can extract from the system is obtain in the reversible case where the entropy stays the same. We can see this by considering two processes, one where the entropy increases and one where it stays the same. Then we can go from the latter to the former by dumping energy extracted in the form of work as heat into the system at constant volume of $V_1+V_2$ until we reach the same entropy as the former system (and as a result also the final temperature of the latter system, as volume, entropy and number of molecules completely determine the thermodynamic state of the system). Since we've then thrown away work to arrive at the former end state, with entropy increase you're alway worse off then when the entropy stays the same.
To find the maximum amount of work, we thus need to equate $S_{\text{final}}$ to $S_{\text{initial}}$, we can then solve for $T_{f}$, the drop in the internal energy is then the maximum amount of work extracted from the system (note that no heat can have been added or extracted from the system, because the total entropy has stayed the same, therefore the entire internal energy change is due to work). Solving for $T_f$ yields:
$$T_f = T_i \left(\sqrt{\frac{V_2}{V_1}}+\sqrt{\frac{V_1}{V_2}}\right)^{-\frac{N k}{C_v}} = T_i \left(\sqrt{\frac{V_2}{V_1}}+\sqrt{\frac{V_1}{V_2}}\right)^{1-\gamma}$$
where we've used that $C_V = \dfrac{f}{2}N k$ and $\gamma = \dfrac{f+2}{f}$ where $f$ is the effective number of degrees of freedom per molecule.
The total amount of work $W$ that can be extracted is therefore equal to:
$$W = 2 C_V (T_i - T_f) = \frac{2N kT_i}{\gamma - 1}\left[1-\left(\sqrt{\frac{V_2}{V_1}}+\sqrt{\frac{V_1}{V_2}}\right)^{1-\gamma}\right] $$
The ideal gas law strictly applies only to ideal gases, which do not condense to form a liquid. This means that there is no vapor pressure associated with ideal gases, which are used to represent real gases that are at a temperature that is very much higher than their condensation temperature.
Regarding vapor pressure, practically every liquid contains atoms or molecules that have enough velocity to escape into the vapor phase. In a closed and evacuated container that initially contains only a liquid such as water, these molecules will move into the vapor phase at a rate that depends on the temperature of the liquid. With no outside heat source, such a liquid will lose temperature as this happens, so heat input to this system is required to hold the liquid temperature at a specified value as water evaporates.
As more and more molecules enter the vapor space, there will be water molecules that strike the liquid surface and re-condense. Thus, there is a rate at which water in the container evaporates and a rate at which water in the container condenses. Assuming a constant temperature, and a constant rate of water evaporation, the water vapor density rises with time, as does the rate of water vapor molecules striking the water surface and re-condensing. At equilibrium, the rate of water evaporation and water condensation are equal.
Water vapor molecules in the vapor space of the container are also striking the surfaces of the container, producing pressure as a result. At the equilibrium point, the pressure that is produced is the vapor pressure of the liquid. This vapor pressure is related to the liquid temperature via the Antoine equation. For much more information, see https://en.wikipedia.org/wiki/Antoine_equation
Best Answer
You can get nothing out of equilibrium thermodynamic considerations for the rate at which pressure will equalize. What will matter is the speed of sound in the gas, as that is the rate at which density fluctuations travel in a fluid and assuming an equation of state, say $p(\rho)=\rho^{\gamma}$, the pressure is then enslaved to the density. So the sound waves then are basically pressure waves and the velocity of sound will determine the time scale of relaxation or equalization of pressure in the two containers. If the fluids are assumed to be incompressible, then the pressure equalizes instantly as the speed of sound is effectively infinite. In case of dense fluids (which are almost always assumed to be incompressible), Pascal's law dictates equalization of pressure upon contact of fluids, though diffusion will moderate the mass efflux, independent of pressure.