Initially, Yehuda thought that the time had come to be punished for selling Yosef. Since they had sold Yosef as a slave, they would all now be taken as slaves. That is why he said, What can we say and how can we justify ourselves. The Al-mighty has found the sin of your servants (Bereishis 44:16), meaning the sin of selling Yosef. However, when he saw that they would all be freed and only Binyomin would be kept as a slave, he realized that this punishment was completely unrelated to the selling of Yosef because Binyomin was not involved in that incident at all. This was solely an unjust punishment. Therefore, he now spoke harshly to Yosef.
Why didn't Yaakov give the same warning when the brothers left for Mitzrayim?
Chazal say, Learning Torah is a greater Mitzvah then honoring one's parents (Megillah 16b). The proof to this is that Yaakov was punished through 22 years of suffering when Yosef disappeared corresponding to the 22 years he spent at Lovon's house when he didn't fulfill the Mitzvah of honoring his parents. However, he was not punished for the 14 years he spent learning Torah with Shaim and Eiver (Megillah 17a).
We see that this Halacha regarding the precedence of learning over honoring one's parents was made clear only after Yosef revealed himself after 22 years. Prior to this, honoring one's parents was a greater Mitzvah because we compare their honor to that of Hashem (Bava Metzia 32). Therefore, Yaakov didn't need to warn the brothers about not learning on the way to Mitzrayim because they knew on their own that honoring their parents was more important than learning and they were travelling at their father's command. However, on their return, after the Halacha was clarified and learning Torah is actually more important than honoring one's parents, Yosef needed to warn them to not learn in-depth so that they would not get lost.
The Meshech Chochma notes that Chazal tell us (Gemara Megilla 16b) that because Yaakov was unable to honor his parents for 22 years, Yosef was taken from him for that length of time. At this point in time when Yaakov was about to be reunited with Yosef, he feared that perhaps his punishment would continue, and Yosef would not honor him properly. It was for this reason that he brought Korbonos to evoke mercy from the G-d of Yitzchok to ask for atonement for not having honored his father during the years that he was in the house of Lovon.
