1.3 A player qualifies to be registered under a Federation:
(a) if he or she is qualified by citizenship or naturalization in the country of that Federation; or
(b) if he or she has resided for a continuous period of two years in a country of which he or she is not a citizen and, after thorough examination and clearance by the FIDE General Secretary, is approved for registration under the new Federation of his or her country of residence. This two- year period of residence shall be reduced to one year if the player has not participated in any FIDE competition (including continental individual and team events) for at least 5 consecutive years prior to the date of registration.
(c) if FIDE has approved his or her transfer.
Excerpt from the document attached on the FIDE website
Fat fees shall be charged if the federation or player rushes to transfer before fulfilling the condition of continuous two-years residence in the country.