It is impossible to cross overland the border between Algeria and Morocco, it has been closed since 1994 following a political dispute.

The Morocco-Algeria border
Besides taking the plane, the only other option to go from Morocco to Algeria would be to take the ferry with a change in Spain.
Crossing on the south via Mauritania is strongly discouraged since the Sahara region is currently not safe.
Read the Wikipedia page Algeria-Morocco relations to get more information.