The kidneys of a frog, like many other animals, filter the blood and excretes excess water. The ureters then carry the urine from the kidneys to the urinary bladder.
To filter blood and secrete impurities.
Kidneys (or ~ nephridia) appear quite early in evolution, and are responsible for disposing of waste liquids, salts and some other chemicals not wanted by the body.