Rejoining a game is only possible during certain phases of the game. If you leave a game either during the pre-game or during the first minute of the game, the game will automatically cancel (remember the 10 second rule does not apply to the leaver, but as a warning to other players that the match will cancel). You can rejoin the match during the initial hero selection screen if you are lucky enough to quickly reconnect though.
Otherwise, you can only rejoin any-time after one-minute of match time has passed up until the match completes. However you only have two minutes to do so without penalty. If you rejoin a match after two-minutes, you will still automatically be marked with a loss an be penalized with a -50 SR cut and a ten-minute suspension. This rule ensures that no one can abusive the leaver system by attempting to return to a match after deliberately leaving in order to avoid such penalties. Furthermore leaving three or more times in a single match will result in an automatic penalty. If you fail to return to a match by the time it ends normally (regardless of match result) you will be penalized.
Unfortunately all disconnections and game crashes counts as leaving the match and will be penalized appropriately. The game server has no way to discern a legitimate disconnection or game crash from one that is forcefully caused by a dishonest player to bypass leaver penalties. You can learn about this policy here: