There is a difference between "stop doing sth." and "stop to do sth." in English:
"stop doing sth.": stop an ongoing action.
"stop to do sth.": stop a preceding action and start another one.
Therefore, "they stopped to study languages" actually means they stopped whatever they were doing just now and started studying languages.
I would assume that to translate "they stopped to study languages", you might need the word "por": Ili ĉesis por studi lingvojn.