  We study the relation between class S theories on punctured tori and
isomonodromic deformations of flat SL(N) connections on the two dimensional
torus with punctures. Turning on the self dual $\Omega$-background corresponds
to a deautonomization of the Seiberg-Witten integrable system which implies a
specific time dependence in its Hamiltonians. We show that the corresponding
$\tau$-function is proportional to the dual gauge theory partition function,
the proportionality factor being a non trivial function of the solution of the
deautonomized Seiberg-Witten integrable system. This is obtained by mapping the
isomonodromic deformation problem to $W_N$ free fermion correlators on the
torus.
