We are planning a two-night trip to the Canary Islands. The cheapest options include Lanzarote and Las Palmas for flights. Travel dates are last week of November, so I guess weather should be okay. I have never been to these islands. I'd like to sleep on the beach in a tent or mattresses. Is that possible, safety, legality, and weather? It would also be nice to know how populated with tourists the islands are.
Technically, sleeping in the beach is forbidden in the whole country.
However, there are some exceptions detailed in 7 playas donde puedes acampar that is, 7 beaches where you can camp. In there it talks about El Salado in Lanzarote (in Spanish, my translation):
Camping and sleeping in the beach is not easy. Moreover, it is forbidden in most of Spanish coast apart from some exceptions. The beach El Salado is one of them, a natural gem in Lanzarote in the edge of the island La Graciosa. You need some time to reach this paradise where you can dive naked and sleep without restrictions, but it is worth it.
In the official page ACAMPADA: PLAYA DE "EL SALADO" (CALETA DEL SEBO) you have a form to ask for permission to camp in that beach.
Note that La Graciosa is a little island to the north of Lanzarote, so you need to take a ferry from Órzola to get there.
I'd like to sleep on the beach in a tent or mattresses. Is that possible, safety, legality, and weather?
Since you will be in an official camping zone, safety should be more than fine. In general, Canary islands are quite safe.
The weather in those islands is sub-tropical, meaning that temperature is around 25ºC all year long. It can get a bit cooler at night, but I wouldn't expect less than 15ºC. Also, rain is quite rare.
It would also be nice to know how populated with tourists the islands are.
You can get plenty of information in Wikipedia or other sources. Specifically talking about Lanzarote, it has some tourist-intensive areas, but overall it has a good balance.