There is no scientific way to calculate the probability of a risk, it comes from your experience, the experience of other project managers in your company, and collected data.
For example, if you're managing a construction project and your project is executed in July in California and raining will pose a risk to your project, the you look at meteorological data for that month over the last 20 years, you compile it, and you see how many times it rained in July, if it rained 10 times out of 20, then the risk probability is 50%.
As stated above, you can also determine the probability of the risk from your own experience. For example, if you know that for every 3 software development projects that you manage the lead developer quits, then you should add this as a risk called "Lead developer quits", and you should assign a risk probability of 33%.
Also (and again, as stated above), you can get the probability of a risk by consulting with fellow project managers in your company, or even better, the PMO, who should have stored data for all the risks in all your projects: which risks occurred and which risks did not occur.