Your question is a little confusing, so I have included two answers.
If you are asking if it's possible to take the bar exam without going to law school at all:
Some states (including California, New York, and Virginia, among others) still follow the practice of allowing someone who has studied law under a practicing attorney in his law office to take the bar examination without attending law school. In the old days this used to be known as "reading law" but it's very uncommon today even when a state technically allows it. Typically examinees who opt for this route do poorly on the bar exam with low pass rates.
If you are asking if it's possible to take the bar exam in state A if you have attended law school in state B:
Yes, this is actually very common, but if the school in question isn't an ABA-approved school, then state A may not allow graduates of that school to sit for the state A exam. If the school in state B is ABA-approved, there's generally no problem at all taking the exam in state A.