The opposing team can't get the batters out and some time limit is reached- the field has to be closed or the batters are physically exhausted so can't continue so the game is stopped in certain innings.
Yes, the game can be suspended due to several reasons listed in the rules (7.02(a))
- league imposed time limit
- equipment failure (such as lights or roof)
There are a few other rules that then determine what happens next. If most of the game has been played and one team is ahead, the game can be called (ended) and a winner declared. In other circumstances the game can be postponed and resumed later or replayed from the beginning.
If possible, umpires would prefer to stop between innings, but weather or equipment failure may not make that possible. Time is not normally a factor in MLB games (they can be played quite late), but it can happen.
A 1984 game between the Brewers and White Sox was still tied after 18 innings. The game was suspended at that point and resumed the next day and completed in the 25th.