If you suffer shoulder pain, please be cautious throwing overhead. Throwing overhead can further increase shoulder impingement syndrome, the most common cause of shoulder pain. Of course if you throw gently you are likely to be fine, but throw a heavy object hard and you may well aggravate that pre-existing shoulder problem.
If you want to throw hard, then train your muscles by strengthening the rotator cuff. There is also a lot of technique involved in throwing, so learn how to throw properly by talking to a sports or athletics coach.