The casual contraction wie geht's does not have any personal pronouns. It can therefore mean all of the following:
Wie geht es dir/Ihnen/euch?
It is indeed possible to ask someone "Wie geht's" even if you address them with "Sie" otherwise.
Still, whenever we need to be formal or polite we may not want to leave the impression of being casual. To be on the safe side we then may better ask "Wie geht es Ihnen?" (even though being asked "Wie geht's" is likely not being perceived as disrespectful) or do not ask this at all. We have to keep in mind that asking this in a formal setting is by far not as common as it is in English. It may lead to some confusion if the answer was different to "Danke, gut" but you were not at all prepared to talk about the other person's well-being.
As a rule of thumb we may use the casual form if we had met the person several times before, or are in an otherwise not too formal relationship.
Examples:
- Neighbours meet: "Hallo Herr Maier, wie geht's?"
- A medical doctor asks you: "Guten Tag Frau Müller, wie geht's heute?"
- We are at work where the "Du" was discouraged for some reason (e.g.by corporate policy).
On the other hand we can also ask close friends or family members with the long un-contracted version.
Wie geht es dir?
This may then indicate our honest interest where it likely will initiate a conversation on personal matters.