Unfortunately, the only way from the Algarve to Morocco is via Seville and Algeciras/Tarifa.
There are no direct flights.
There is no rail link from the Algarve into Spain.
The road routes run east from the Algarve frontier to Huelva and then to Seville. There reason is that there is a large national park protecting the Dona Ana Area and Guadalquivir river estuary that lies between Huelva and Cadiz. There are no routes through this park and so one has no alternative but to pass through Seville.
However, there are good bus services from the Algarve to Seville and from Seville to Algeciras/Tarifa.
On the return there are services that run from Seville to Lisbon.
Check out this post on my blog which may help:
http://barlaventostravelblog.blogspot.com/search?q=Tarifa