Making and sharing and using subtitles for movies is not legal. It is copyright infringement. I paint this statement with a very broad brush.
The movies are copyrighted (they are original and fixed in tangible form). (17 U.S. Code § 102(a))
17 U.S. Code § 106(2) provides that the owner of copyright has the exclusive rights to prepare and to authorize to preparation of derivative works based upon the copyrighted work.
17 U.S. Code § 101 defines derivative work as
a work based upon one or more preexisting works, such as a
translation, musical arrangement, dramatization, fictionalization,
motion picture version, sound recording, art reproduction, abridgment,
condensation, or any other form in which a work may be recast,
transformed, or adapted....
So we have established that the copyright holder has exclusive rights to authorize translations, but this exclusive right is limited by fair use. 17 U.S. Code § 107 provides some examples of fair use:
criticism, comment, news reporting, teaching (including multiple
copies for classroom use), scholarship, or research
If these subtitle files are not used for a fair use purpose (the examples cited are examples only, not an exhaustive list) then translation is infringement.
If the files are used for one of the fair use purposes then § 107 also gives us the factors to determine whether that particular use is fair use:
(1) the purpose and character of the use, including whether such use
is of a commercial nature or is for nonprofit educational purposes;
(2) the nature of the copyrighted work;
(3) the amount and substantiality of the portion used in relation to
the copyrighted work as a whole; and
(4) the effect of the use upon the potential market for or value of
the copyrighted work.