She was captured by Darth Malak. He didn’t want to kill her as he predicted that her Battle Meditation abilities would be incredibly useful in battles against the Republic. So, he tortured her and fed on all her insecurities and resentment until she snapped and gave in to the Dark Side of the Force. In the KOTOR game, you can choose whether to kill Bastila, join her in the Dark Side, or bring her back to the Light Side. The publicly stated ending is that she rejoins the Light Side. However, the Dark Side ending of the game is fairly interesting. Revan and Bastila end up killing several of their party members, and Bastila tells the Republic forces that she’ll use her Battle Meditation to help them, only to betray them in the middle of the battle. Revan and Bastila go on to become Rulers of the Sith after defeating Malak.