Back when the Shisengumi was known as the "Miburoshigumi" (referring to the historical group Rōshigumi, the self-proclaimed Kyoto Defenders) the organization was was made up of two groups. 7 from the Shieikan Dojo and another 3 from Serizawa Kamo's group. Kondo decided to make Kamo commander in order to unify the groups, but Hijikata opposed it. The tensions between Kondo and Kamo would eventually lead to the fateful assassination of the latter, but whether Kondo carried it out is unclear.
The truth is that Kondo formed the Shisengumi to help him reunite Japan by burning down the Imperial Palace, including all of Kyoto, leaving all authority with the Shogunate. He wants to move the capital to Edo instead, well knowing how many people will die because of it. In reality, it doesn't matter to him whether it is the Imperial Court, or the Shogunate. One must simply go away for Japan to get the military strength to fight off the foreigners from England and America.
Kondo is a shrewd and heartless man, who sees his men as nothing but pawns to achieve his goals. The Shisengumi is only as useful to him based on how much worth their skills are. He lets Ryoma stay with the Shisengumi, even after fighting him to the death, because he is still useful to him even if he isn't consciously aiding him.