"For all intents and purposes" is the correct phrase according to American usage. The British version of the idiom is "To all intents and purposes." (See the Related link.)
Neither of the phrases in the question is correct. The correct wording, in American English, is "for all intents and purposes." In British English, however, the wording of the selfsame idiom is "to...