Dietary factors and hydration
play a role, but in most case, there is some metabolic predisposition. Having a family member who had kidney stones increases one's risk of having stones as well. A work-up to determine the cause of stones is warranted if you have had more than one episode. See your urologist.