Malcolm X was, in his early days especially, a person who held very different opinions than Martin Luther King, Jr. did. King believed in nonviolent resistance. Malcolm X did not. That is what he means by "ballots or bullets."
Malcolm X is also famous for saying that blacks should seek change and justice "by any means necessary." What this means is that blacks should not renounce violence as a means for getting what they want. If they can get what they want by peaceful means such as elections (ballots) they should. But if they can only get what they want through violence (bullets) they should not be afraid to use violence.
So, by speaking of "ballots or bullets," Malcolm X is expressing the idea that blacks should do whatever it takes to get justice, even if that includes violence.