Under the reserve clause, teams could "own" players because that is what the contracts said. The reserve clause was a clause in every contract signed by professional baseball players. It stated that the team held the player's rights even after the term of the contract had elapsed. The player's only options would be A) to sign another contract with the same club, B) to ask the club to release or trade him or C) to stop playing.
As to why this was allowed, that is more difficult. The reserve clause was, one can argue, allowed because of the idea that baseball (and other sports) were just games and that the athletes should be grateful just to have the chance to play. One can argue that it was also allowed because players had so much less leverage than owners did.