Beer does not "flush out the kidneys". Drinking any liquid will increase urine output but the kidneys will flush themselves out. They do not derive any particular help from the specific liquid that is taken.
You can prevent kidney stones by drinking plenty of water and maintaining a healthy diet. Alcohol is linked to kidney stones made from uric acid. Beer has been linked to protection from kidney stones in a few small studies; however, beer consumption is not recommended to prevent kidney stones.
How beer helps: Beer is naturally diuretic, which means that it increases production of urine. This might help you pass a stone that is stuck in the ureter due to increase flow but there would need to be enough fluid in the system in the first place. It's still important to drink water.
Water is best. You can also drink ginger ale, lemon-lime sodas, and fruit juices. Drink enough liquids throughout the day to make at least 2 quarts (2 liters) of urine every 24 hours. Drink enough to have light-colored urine.