All of the variations are correct and natural.
Both of the students.
Both the students.
Both students. (most common)
Here is a google ngram of "both children," "both the children," and "both of the children," in the English Fiction corpus. The phrase "both children" is most common, then "both the children" is next, and "both of the children" is least common.