We study the Susceptible-Infected-Susceptible model of epidemic spreading on two layers of networks interconnected by adaptive links, which are rewired at random to avoid contacts between infected
and susceptible nodes at the interlayer. We find that the rewiring reduces the effective connectivity for the transmission of the disease between layers, and may even totally decouple the networks. Weak endemic states, in which the epidemics spreads when the two layers are interconnected but not in each layer separately, show a transition from the endemic to the healthy phase when the rewiring overcomes a threshold value that depends on the infection rate, the strength of the coupling and the mean connectivity of the networks. In the strong endemic scenario, in which the epidemics is able to spread on each separate network –and therefore on the interconnected system– the prevalence in each layer decreases when increasing the rewiring, arriving to single network values only in the limit of infinitely fast rewiring. We also find that rewiring amplifies finite-size effects, preventing the disease transmission between finite networks, as there is a non zero probability that the epidemics stays confined in only one network during its lifetime.