Since frogs originate as tadpoles, they initially breathe underwater and only grow lungs at a later stage. Due to this late transition, frogs don't have many of the muscles and bones typically used for breathing, such as ribs or a diaphragm. Ribs and a diaphragm are necessary for expanding the chest and decreasing pressure in the lungs to let air in, so frogs need another method to utilize their lungs.
Along with the expansion of the throat, frogs also breathe with their skin. Their skin is membranous, containing a whole network of blood vessels called capillaries. Air gets trapped by the membranes in the skin, and the respiratory gas is diffused to all the capillaries and then taken within the body. This breathing process is necessary while frogs transition from having gills to having lungs. The process remains useful for whenever they are submerged in a substance, which is common in their natural habitat.