Total internal reflection is an optical phenomenon. When light crosses materials with different refractive indices, the light beam will be bent at the boundary surface ( Light Refraction). At a certain angle of incidence (the critical angle), the light will stop crossing the boundary but instead reflect back internally at the boundary surface. This occurs only at a high-Refractive Index/low-Refractive Index boundary, not the other way around. For example it will occur when passing from glass to air, but will not occur when passing from air to glass. (Source: Wikipedia)
In widefield microscopes and confocal microscopes this loss of high-angle rays reduces the effective Numerical Aperture of the objective, and therefore the resolution. (See Image Formation). This will happen in a Refractive Index Mismatch situation, which should be avoided during the image acquisition.
There is a type of microscope called TIRF that make use of this phenomenon to image thin layers right at the boundary by using high-angle incidence illumination: only in this case the total internal reflection is a benefit. See Total internal reflection fluorescence microscope. To deconvolve images from these microscopes, see the FAQ Can I deconvolve images acquired with a TIRF system?.
Image from Harvard University Natural Science Lecture Demonstrations