They will just not foght each other.. first of all the US backs Morocco fully and recognize its sovereignty on Western Sahara historically.. Russia won't back Algeria Militarily.. but it will pull it to reason..
The main fact here that you all seem not to know it there was a big war between Algeria and Morocco in the Western Sahara for almost 20 years from the 70s up to the 90s .. and where Algeria and the Polisario couldn't take any part of the Western Sahara.. eventhough Morocco was "much weaker"..
https://en.wikipedia.org/wiki/Western_Sahara_conflict
I don't like to take sides in this but it is Morocco who has liberated the Western Sahara from Spain ..
Around 1000 Algerian soldiers prisoners in the Western Sahara war in 1976
I will make a thread on this topic later.. there is a lot of information out there and much truth..