The principle behind Perls' stain involves the formation of a colored complex between iron and a reagent. Tissue sections are treated with a solution of potassium ferrocyanide, which reacts with ferric iron (Fe3+) to form an insoluble blue pigment called Prussian blue. This reaction is specific to ferric iron, making it a reliable method for detecting iron deposits.