וַ֠יָּבֹא אֶל־גִּדְר֨וֹת הַצֹּ֤אן עַל־הַדֶּ֙רֶךְ֙ וְשָׁ֣ם מְעָרָ֔ה וַיָּבֹ֥א שָׁא֖וּל לְהָסֵ֣ךְ אֶת־רַגְלָ֑יו וְדָוִד֙ וַאֲנָשָׁ֔יו בְּיַרְכְּתֵ֥י הַמְּעָרָ֖ה יֹשְׁבִֽים׃
Er kam zu den Schafhürden am Wege, dort war eine Höhle; Saul ging hinein, seine Notdurft zu tun. David aber und seine Leute saßen an der Hinterseite der Höhle.
Rashi
according to my righteousness that I did not slay him when I sliced off the skirt of his coat. [Obviously, Rashi explains verses 8-17 as referring to Israel’s departure from Egypt. Only in verse 17 does he suggest the explanation that David refers to his own experiences.]
Metzudat Zion
It is a euphemism for reliving himself as an Samuel 1:24:3 "And Saul came to relive himself." Its named this based on the way that he is sitting down and facing. To shut in and to cover his legs because of modesty.