I believe it is not good practice (although have been guilty of it myself). What happens if the link ceases to existsexist? The answer becomes worthless. I would prefer to paste the main gist of the answer into the answer so if the link ever goes down for whatever reason then the answer is still valid.
A large majority of my answers involve providing demo'sdemos of code via a live pastebin, however if these external sites go down, what is the point? I have pushed for a Stack Overflow pastebin to minimise this risk, but so far it has fallen on deaf ears.