We employed data from the VISTA near-infrared YJKS survey of the Magellanic System to analyse the light curves of Type II Cepheids (T2Cs) in the Large and Small Magellanic Clouds (LMC and SMC, respectively). Using the T2Cs identified by the OGLE IV survey and Gaia mission, we built up a sample of about 330 pulsators belonging to both galaxies. For all these objects we obtained accurate intensity-averaged magnitudes in the YJKS bands by means of a template-fitting technique. We complemented our near-infrared data with optical photometry from the literature to calculate period-luminosity and period-Wesenheit relations for a variety of different bands and colour combinations and separately for the different T2C subclasses (BL Herculis, W Virginis, peculiar W Virginis, RV Tauri). These relations, calibrated with the LMC distance modulus, were tested using T2Cs belonging to Galactic globular clusters. We thus calculated the distances of 22 clusters and compared them with the literature values, mainly based on RR Lyrae stars, finding good agreement within 1 σ and dispersion of the order of 0.3 – 0.5 kpc, depending on the adopted period-luminosity/period-Wesenheit relation.