At pool, there are penalties for fouls. You are permitted to make almost any shot you please and if it is a foul, you pay the penalty. The penalty for the foul you describe is ball in hand for the opponent.
As was pointed out, if it is not a tournament, you could be in trouble. Byrne tells the story of a player (who was just in Louisville, actually) who went into a bar to play a game or two. He found himself without any shot, so he played a pretty good safety, ball and rail and everything. His opponent punched him in the face knocking him to the floor. "We don't do that around here."