The function of the kidneys is to regulate fluid and electrolyte balance. The kidneys help to regulate water and sodium in the body by producing urine. The urine contains higher or lower concentrations of water and electrolytes based on the body's needs.