Refraction is the change in direction of a wave due to a change in velocity. It happens when waves travel from a medium with a given refractive index to a medium with another. At the boundary between the media the wave changes direction, its wavelength increases or decreases but frequency remains constant.
A well-known optical example of this is looking into a bowl of water. Air has a refractive index of just over 1, and water has a refractive index of about 1.3. If you look at a straight object, such as a ruler, which is placed at a slant, partially in the water, the object appears to bend at the water's surface. This is due to the light rays from the object being bent as they move from the water to the air.
Refraction is also responsible for rainbows and for splitting up of white light into a rainbow-spectrum as it passes through a glass prism. Glass has a higher refractive index than air and the different frequencies of light travel at different speeds (dispersion), causing them to be refracted at different angles. The different frequencies correspond to different colours observed.
The amount that the light bends during refraction is calculated using Snell's law.