In this work the interaction of electromagnetic field with quasi-periodic media has been scrutinized. We have obtained the formula for a distorted medium polarizability tenzor in the X-ray frequency band. Also there have been obtained the X-rays dynamic diffraction equations for media with arbitrary smooth distortion. For these equations the Takagi-Tuipin equations are obtained as a particular case. We have got a very simple formula for the coefficient of X-ray reflaction on the bent Bragg mirror. We have scrutinized the example of calculating the X-rays reflaction and focusing by the bent Bragg mirror. Also in this work one could find the rezults of calculating the reflected X-rays caustics form. It is shown that there exists a possibility of linear dimensions of the X-rays focusing area having typical values of 10^-7 cm.