As I understand it, they were supposed to be there to conquer Pagan Lithuania. Then Lithuania converted to Catholicism. So the Knights... stayed around and tried to mess with the Lithuanians, until eventually they fought a massive battle against the combined Lithuanians and Polish. But how did they justify this? As an order of militant monks, didn't it rather go against the whole point of them? And how/why were they still getting recruits after the pagan "threat" was over?
Ok so there is a lot going on with this question.
Lithuania was a pagan state until the Union of Krew(v)o in 1385-1386.
The knights that you refer to in your question would be the Teutonic Order, but by the time of the Union of Krewo they would have expanded and absorbed smaller regional orders as well. The most prominent one (and possibly only one) was the Brothers Militia of Christ in Livonia called the Sword Brothers today by most historians.
Starting from around 1200 AD there was conflict between Germanics, Danes and Rus, Lithuanians and various tribal groups in the area which became Prussia and Livonia. The conflict in these regions ended essentially with the events of the St.Geroge's Night Uprising in 1350 AD (in Livonia).
After this and the above mentioned union of krewo the knight order sort of morphed into a secular power, though I would argue it had always functioned like that. Once the knights were a primarily secular power then they acted like one and engaged in warring for the sake of territory ect.
The second battle you refer to is the Battle of Grunwald in 1410 which saw the now Polish-Lithuanian Commonwealth defeat the order.
As to why the order kept getting recruits second and third sons of nobles made up a good chunk of their ranks.
Looking at catholic teaching there is no way to justify violence against other catholics for political sake. There is also little justification to convert people by the sword, which is why Poland in 966 AD was baptised without much violence and why in Livonia tribes who accepted the catholic faith without violence were treated well and not hurt for religious reasons.
As for sources I will provide easier to access ones (ie not routledge/brill, but i can provide them if you want them)
Read the following
Norman Davies God's Playground a History of Poland (volume 1 is the relevant one)
Henry's Chronicle of Livonia (translated by James A. Brundage) Colombia University Press 2003
Aleksander Pluskowski Archaeology of the Prussian Crusade
(this is a more expensive book) but Anti Selart Livonia Rus and the Baltic Crusades in the 13th Century Brill 2015
Also try more general sources such as William Urban's History of the Teutonic Knights or God's War by Christopher Tyerman. Lastly you could also look into catholic teachings but this is not required for more general level answers.
edit and Stone's more recent volume on the Polish-Lithuanian Commonwealth (sometimes Davies is a little too Polish centric).