One of the most common incidents is when you sink your opponent ball in or pot the opponent ball instead of your own. Whether this is a foul or not depends on if you hit your opponent ball first or your own type ball.
Short Answer: If you hit your ball first then there is no foul, if you hit opponent ball first and pot it then it will be a foul.
IF YOU ARE PLAYING 8 BALL
For the sake of this discussion, we will consider that your ball type is a stripe and your opponent is solids.
Case 1: When you Hit Your Ball first and Pot Opponent ball After
In such scenario, potting the opponent ball (solids) is not a foul. The opponent will get to play the cue ball from where it stopped at the end of your stroke. The next turn will not be yours rather it will be transferred to your opponent.
Case 2: When you Hit Your Opponent Ball First and Pot it in
In this case, you have fouled. Touching the solids (opponent ball type) first whether you pot it or not the foul result is the same i.e. the next turn would be of your opponent and the opponent can place the ball wherever on the table behind the second dot marked on the table rail.
IF YOU ARE PLAYING 9 BALL
According to the rule of this game, the striking player has to hit the lowest numbered ball first.
If you hit the lowest ball first and pot a higher number ball then the turn will remain to you. If the ball potted is 9 ball then you win the game and the game ends.
If you hit the ball other than the lowest number then the turn will be transferred to the opponent.
IF YOU ARE PLAYING 10 BALL
In the case of 10 balls, if the ball is potted other than the lowest number of the ball then the turn would be passed on to the opponent.
If the other ball potted is 10 ball than the ball is taken out and placed back on the table on the dot where the rack is placed.