IRAM 30m 12CO(1-0) and 12CO(2-1) HERA observations are presented for the ram-pressure stripped Virgo spiral galaxy NGC 4522. The CO emission is detected in the galactic disk and the extraplanar gas. The extraplanar CO emission follows the morphology of the atomic gas closely but is less extended. The CO maxima do not appear to correspond to regions where there is peak massive star formation as probed by Halpha emission. The presence of molecular gas is a necessary but not sufficient condition for star formation. Compared to the disk gas, the molecular fraction of the extraplanar gas is 30% lower and the star formation efficiency of the extraplanar gas is about 3 times lower. The comparison with an existing dynamical model extended by a recipe for distinguishing between atomic and molecular gas shows that a significant part of the gas is stripped in the form of overdense arm-like structures. It is argued that the molecular fraction depends on the square root of the total large-scale density. Based on the combination of the CO/Halpha and an analytical model, the total gas density is estimated to be about 4 times lower than that of the galactic disk. Molecules and stars form within this dense gas according to the same laws as in the galactic disk, i.e. they mainly depend on the total large-scale gas density. Star formation proceeds where the local large-scale gas density is highest. Given the complex 3D morphology this does not correspond to the peaks in the surface density. In the absence of a confining gravitational potential, the stripped gas arms will most probably disperse; i.e. the density of the gas will decrease and star formation will cease.