Roots keep trees anchored firmly to the ground.
Noun
Pronoun
Verb
Adjective
Adverb
Preposition
Conjunction
Interjection
To is a preposition in this sentence.