Mercury(II) iodide is used for preparation of Nessler's reagent, used for detection of presence of ammonia.
Mercury(II) iodide is a semiconductor material, used in some x-ray and gamma ray detection and imaging devices operating at room temperatures.
In veterinary medicine, mercury(II) iodide is used in blister ointments in exostoses, bursal enlargement, etc. 
It can appear as a precipitate in many reactions.