MJ's first retirement took place on on 10/6/93 and was a complete shock. No one could believe that Jordan, at the top of his game (leading the NBA the previous season in both scoring and steals), was serious. But after the murder of his father, he decided to make the move to professional baseball. Jordan famously came back a year later and won the NBA title in three straight seasons for the second time.
Jordan's retirement in 1999 was again surprising considering the level his game was at (leading the league in scoring with 28.7 ppg), but not surprising considering the state the Bulls were in at the time. Jerry Krause was hell bent on tearing apart the team and rebuilding. Phil Jackson's contract was up and everyone knew he wouldn't be renewed, as was the same for Dennis Rodman, while Scottie Pippen forced his way out via trade demand.
But perhaps as impactful as any other factor, the NBA was mired in a lockout, which would limit the upcoming season to just 50 games. So MJ would've had to come back and play without Pippen, Rodman, or Phil Jackson, while also missing several other key components of the championship squad who were either dealt or released. In a lot of ways, Jordan's back was against the wall; it was time for him to do something else.