It depends on which stage of the negotiation you decide to withdraw the offer. If it happens before the signing of the contract there won’t be any kind of legal consequences.
Otherwise, if the contract is signed there could be legal consequences which depend from the terms of the contract concluded between the parts. If during this period of time the visa or the residence permit is released by the authority, it will be revoked.