If it is legitimate, of course.
No way you can regulate this kind of stuff. Retiring when you are in a losing position when it is not legitimate is bad sportsmanship but that is it.
Breaking your leg is an extreme and unlikely example, but it is possible. There are other possibilities I am sure.
It is amazing that some players do it during the slams.