Three-batter minimum
Official rule: The starting or any relief pitcher is required to pitch to a minimum of three batters, including the batter then at bat (or any substitute batter), until such batters are put out or reach base, or until the offensive team is put out, unless the substitute pitcher sustains injury or illness which, in the umpire crew chief’s judgment, incapacitates him from further play as a pitcher.
To me, that says a pitcher must face either 3 hitters, or remain in the game at least until the end of the inning.