The term forsake
here refers to divine abandonment that would result in defeat at the hands of enemies. It is used to elsewhere in Joshua to describe Israel abandoning God to worship other deities (Joshua 24:16, Joshua 24:20). When God promises not to forsake Joshua, he is promising to remain faithful to Joshua and Israel, to remain on their side and fight for them.1
5 No man shall be able to stand before you all the days of your life. Just as I was with Moses, so I will be with you. I will not leave you or forsake you.