1. The problem statement, all variables and given/known data

2. Relevant equations

Limiting Frictional Force = [tex]\mu[/tex] x Normal/reaction offered by the surface.

Force due to spring = k * Elongation of spring (from its natural length)

3. The attempt at a solution
If m_{2} is to move, it needs to experience a force of [tex]\mu m_{2}g[/tex] (to oppose the friction), which can be only experienced from the spring.
This means the spring's elongation at that instant is atleast [tex]\frac{\mu m_{2}g}{k}[/tex].
An equal and opposite force acts on m_{1}. For m_{1} to move, net force on it must be greater than [tex]\mu m_{1}g[/tex].
That gives [tex]F=\mu m_{1}g+\mu m_{2}g[/tex], which is incorrect.

The answer is [tex]F=\mu m_{1}g+\frac{\mu m_{2}g}{2}[/tex], which I have no idea of where it could possibly come from.

That is precisely correct. F = -kx assumes that one end of the spring is fixed, which is not true in this case. Try a special coordinate system where one direction is toward the center of the spring, and one direction is away from the center of the spring.

Ask yourself: If you applied such a force through a distance x (the required elongation), how much energy will m1 have? If m1 has extra energy beyond that needed to stretch the spring, then you've pushed too hard. Note that the spring force is not constant.

Sorry, i meant ug(m_{1}+m_{2}). Does the problem ask the minimum constant force? If so, it is really
ug(m_{1}+m_{2}/2), and anyway, it is less than ug(m_{1}+m_{2}), so you are right...

So we apply a constant force F along a path Δx, first accelerating m_{1}, than letting it decelerate, stopping at the end. According to the Work-Energy Theorem, the work of all forces equals to the change of KE which is zero now. So
W=(F-μm_{1}g)Δx-kΔx^{2}/2 =0, F=μm_{1}g+kΔx/2