Does a particle interact with walls of a slit? It is kind of mystical that a particle goes through a slit and eventually changes its impulse due to Heisenberg uncertainty. Since the slit is an opening, it must not have interacted with it. Does it interact or not? If yes, than how? By virtual photons, or something else?
 A: The conventional explanations of what happens when light or other waves hit a slit or small aperture in a barrier assume that the barrier is a classical object that blocks the transmission of the incident wave. You might consider  it possible, therefore, that there is some quantum-level interaction between the light or matter wave and the material of the barrier, given that the barrier is composed of quantum particles after all.
However the difficulty in considering that is that the diffraction that occurs seems to be largely independent of the material of which the barrier is made and the nature of the incident wave. Electrons and neutrons are both diffracted in a similar way, even though neutrons- having no charge- would not be subject to the same electromagnetic interactions that an electron might experience with the material of the barrier. Likewise, the diffraction pattern does not seem to be affected by whether the barrier is a conductor or an insulator, which again suggests that quantum level interactions between the wave and the barrier are not significant.
A: Yes the photon interacts with the slit, from a momentum perspective the slit (material) is much much heavier (connected to the apparatus, etc) than the photon, any momentum change is equaled by momentum change in the slit.  This is similar to you jumping up and down on the earth, momentum must be conserved but the earth is so large we do not need to consider it.
We know the photon is the same color going in and out and therfore its energy is conserved.
If you are really asking "why does the wave spread out" than this transfer of momentum appears to have a random or Gaussian nature, the slit is full of atoms and structure and yes virtual photons are the ones that transmit forces but do not exchange energy.
If you are really asking "is the slit wall interaction the reason for the interference pattern" then I would say no.  The pattern is not a result of any properties of the slit (or it's material) only just the dimensions of the slit.  The pattern is a property of the light itself and how it behaves in the EM field .... per Feynman light tends to choose a path that is shortest and has a path length integer multiples of its wavelength.
Integer multiples of wavelength is a fundamental property of resonance and energy transfer ..... laser cavities only lase for example when the mirrors are set integer wavelengths apart.
The final pattern we observe is a combination of the random Gaussian nature combined with the need for light to travel integer paths and shorter path lengths.
A: Quantum mechanics theories have been developed so as to model what happens at the micro world of particles , because classical mechanics and electrodynamics cannot model the data nor predict new ones.
In quantum mechanics one solves with the boundary conditions and for the voltages the particular system under study, and the solution gives the probability for the interaction to happen.
For this question a particle  perpendicular to the surface, scatters off the surface which has a slit, of a given width, and is detected a given distance away. The probability for scattering back or be absorbed by the surface, is part of the solution. The solution in the region of the slit gives the probability of interacting with the fringe electric  fields at the edge of the slit, and being deflected. See the answer here for a single slit  diffraction pattern.

Does it interact or not? If yes than how? By virtual photons or else?

For calculations in electromagnetic scattering at the quantum level  Feynman diagrams are used, and there, virtual photons appear to carry the energy and momentum changes due to the interaction. The Heisenberg uncertainty and the de Broglie wave are an envelope that allows estimates without going into the unnecessary complications of solving hard equations,as it is proven that they arise from the theory of quantum mechanics.
The double slit experiment has been studied, one electron at a time, example, and it is clear how the accumulation of electrons looking random when one by one, shows the probability wave behavior in the accumulation.
A: Your question and the idea behind it is very reasonable, but you cannot get any other answer than the explanation reached and taught. Science works only with an agreement what is right and what is wrong.
The reasons for rejecting contrarian thought are three:

*

*the scientific world would not be one, but a chaotic discussion club in which there is no agreement about what fundamental truths are

*what one is taught for years must be correct, and all the more so because the teaching is accompanied by the sentence: "It is mysterious and not comprehensible, but the results should be explained as interpretable"

*how will a scientist feel if he advocates something that later turns out to be an error.

What I have learned here is that you have to back up your idea with calculations. And that the specialists in energy-material interactions (plasmons, polaritons, ...) will not support your idea.
I support your idea with one small detail. Destructive interference for light or electrons is not a dissipation of energy, but a shift to areas of doubled intensity. This shift must have an origin and your idea may be the reason.
A: The double slit experiment is intended as a demonstration of interference and diffraction. In its idealized form there is no interaction with the walls. It produces a diffraction pattern proportional to the Fourier transform of the transmission of the slit system by selectively blocking oarticles. In practice there are of course deviations from this idealized behavior due to scattering, residual reflection or transmission, light polarisation, surface excitation etc.
If your question however is about the origin of the diffraction, then it is necessary to use Schrödinger's or Maxwell's wave function. Multiply an incoming plane electron or light wave with the slit system transmission's function. In k-space this results in plane waves in all directions with amplitude equal to the Fourier transform of the slit transmission. There is no interaction with the edges other than transmission versus blockage.
A: You say: But as the slit is an opening it must not have interacted with it. This is only true for particles. But QM is about waves and waves have extent. If you take this extent into account, then it is not paradoxical anymore that the screen and the slit and everything else has an influence on the outcome of the experiment even if it finally manifests in a particle that seems to hit a sensor at a specific point.
That’s again the famous wave-particle dualism: an object is “simultaneously wave and particle”. If you have problems understanding this you are in good company: no one understands it. But: the mathematical models to describe the quantum mechanical effects are perfectly well understood and the outcome of experiments is predicted by the models to high accuracy. It is only the interpretation of the effects (predicted by the models and reproduced in experiments) that lacks human understanding.

EDIT
After having read through the other answers and comments, I came to think that your question is another formulation of the measurement problem. In this specific case, the state of the incoming particle comprises a superposition of several states/waves, each of which specifies an exact position of the particle in relation to the slit. Here http://mtnmath.com/faq/meas-qm-2.html the measurement problem is stated as: How does a superposition of different possibilities resolve itself into some particular observation? which, in this particular scenario, is the same as your original question.
A: First, it is necessary to note that two-slit experiment is a thought experiment - its goal is to teach quantum mechanics, the wave properties of electrons, rather than model reality.
However, since the experiments along this line has been done (e g., solid state Aharonov-Bohm interferometers are a bit of a routine nowadays), it makes sense to ask what are the properties of the screen/slits that assure that the experiment is working.
Without going into too many details, let me point out the two principal ones:

*

*The screen is very heavy, so that it is not affected by the electrons hitting it. In other words, there is not energy exchange - no decoherence.

*Screen is static, it is not vibrating - otherwise it would randomize the electron phase - no dephasing.
Update
On a more mathematical level, one can describe the two-slit experiment by Hamiltonian
$$
H=\frac{\mathbf{p}^2}{2m} + V(\mathbf{x}, Q)+H_Q,
$$
where $V(\mathbf{x}, Q)$ is the potential describing the slits, which can change as a function of the screen variables $Q$ - these can be, e.g., phonon modes of the screen vibrations, or screen movement as a whole (in case of a nanomechanical system, such as an STM tip), or whatever corresponds to actual physical realization of the experiment.
We now can consider there cases:

*

*Neglecting screen dynamics - which is the way the problem is usually treated in the textbooks. Then the interference is largely described by the interference between two paths between the origin and the osbervation point on the screen:
$$
\left|e^{i\mathbf{kL}_1}+e^{i\mathbf{kL}_2}\right|^2 = 2 + 2\cos\left[\mathbf{k}(\mathbf{L}_1-\mathbf{L}_2)\right]
$$

*Only elastic scattering. In this case the momentum of electron does not change in magnitude, but the above expression eneds to be averaged over the screen vibrations.
$$\langle\left|e^{i\mathbf{k}\mathbf{L}_1(Q)}+e^{i\mathbf{k}\mathbf{L}_2(Q)}\right|^2\rangle_Q = 
2 + 2\langle\cos\left[\mathbf{k}(\mathbf{L}_1(Q)-\mathbf{L}_2(Q))\right]\rangle_Q \approx\\
2 + 2e^{-r}\cos\left[\mathbf{k}(\langle\mathbf{L}_1(Q)\rangle-\langle\mathbf{L}_2(Q)\rangle)\right]
$$
Although the details of averaging vary depending on the physical implementations, we generally expect suppression of the oscillations, as described by factor $e^{-r}$.

*Finally, if the inelastic scattering is taken into account, we will also need to average over the distribution of the electron momenta after the scatteirng, which will further suppress the interference.

If we exclude the inelastic pricesses, the interference picture can be

References

*

*D. Sanchez and K. Kang, Validity and breakdown of the Onsager symmetry in mesoscopic conductors interacting with environments, Phys. Rev. Lett. 100, 036806

*D. Sanchez and M. Buttiker, Magnetic-Field Asymmetry of Nonlinear Mesoscopic Transport, Phys. Rev. Lett. 93, 106802
A: The incident wave function $\psi(\mathbf{x},t)$ of the particle (described as a localized wave packet) interacts with the walls and propagates through the openings. It is possible to model this process in non-relativistic QM by studying the evolution of the wave packet $\psi(\mathbf{x},t)$ via the time-dependent Schrödinger equation, with a potential that models the walls (the potential goes to zero at the openings).
This QM way of doing things does not model the exact interaction with the particles in the walls (the potential in the Schrödinger equation is a classical, external, one), but this is probably unnecessary (see the answer of @Marco Ocram), especially if we are interested in the late-time dynamics of the diffracted wave packet, far from the openings.
For a simulation of this Schrödinger evolution leading to diffraction and interference, see this video.
Note: in the video we see that part of the wave function is reflected (this is normal since the wall is modelled as an external potential that has no internal degrees of freedom that can be excited or modified, so this is a sort of "elastic" process). In reality, the particle could also be absorbed by the walls, or it could cede part of its total momentum to the internal degrees of the wall: this really depends on the nature of the walls and how they are modelled. However, the part of the wave function that passes through the openings is much less influenced by the details of the walls (note also that part of the wave function can tunnel the walls potential and interfere with the part that propagates through the openings).
