A second monitor is just an extension of your Windows desktop. Apps running on the second monitor don't stop running and don't stop accepting keyboard and mouse input. The monitor is just extended screen space.
If it is new for you having a second monitor, and the thing you're recording is a game that is running in exclusive (true) fullscreen mode on your primary monitor, not in windowed fullscreen mode, keep in mind there are games that let the mouse "escape" from the primary monitor if one uses the mouse near the screen border. This is an especially nasty behavior, because it makes the game vanish (minimized to the task bar). It is minimized, because fullscreen games that lose focus get minimized by Windows, no way around this. This is a shortcoming of the game. OBS is only a victim of that bad mouse behavior, because it is just hit randomly by the escaped mouse pointer. I suffered from this behavior while playing Guild Wars 2.
A direct workaround for this is not possible, except fixing the game by the game developers. Or not using a second monitor. Or switching the game to windows fullscreen mode and at the same time keep track of the mouse even in combat situations and make sure you never let the mouse move over to the other monitor. This is quite difficult to achieve. There exist helper apps that try to restrict the mouse to the game window, but no helper app is perfect.