The rule is 9-6-1.
As Ralph likes to say, there are 3 ways a player can go OOB, (a) intentionally, (b) accidentally, and (c) being blocked by an opponent (blocked by a teammate would fall under (b)).
Per 9-6-1, A players who go OOB and return are guilty of IP unless they are blocked out by an opponent (c), and the spot of the foul is where he returns (not where he participates). Summarized succinctly in 9.6.1A COMMENT:
COMMENT: When A1 goes out of bounds voluntarily or by accident, or delays his return after being blocked out by an opponent, he commits an illegal participation foul when he returns inbounds. The spot of the foul is where he returns inbounds. (10-2-1)