"But theoretically an Afghan citizen could move to Svalbard freely."
This is the principle, but the local laws require visitors to be able to support themselves and not be burden to the society; if you are unable to do this you will be sent back to the mainland.
Jobs are very difficult to come by, and as 90% of the housing in Longyearbyen is corporately owned, finding a place to live without a job can be difficult. [1]
[1] - http://www.nord24.no/her-skal-ingen-fodes-eller-do-men-etter... (in Norwegian)