Shock is formed due to coalescence of various small pressure pulses. Sound waves are pressure waves and it is at the speed of the sound wave the disturbances are communicated in the medium. When an object is moving in a flow field the object sends out disturbances which propagate at the speed of sound and adjusts the remaining flow field accordingly. However, if the object itself happens to travel at speed greater than sound, then the disturbances created by the object would not have traveled and communicated to the rest of the flow field and this results in an abrupt change of property, which is termed as shock in gas dynamics terminology.
Shocks are characterized by discontinuous changes in flow properties such as velocity, pressure, temperature, etc. Typically, shock thickness is of a few mean free paths (of the order of 10 m). Shocks are irreversible occurrences in supersonic flows (i.e. the entropy increases).