Your sentence is almost correct but needs a little fixing to sound better:
Original: Madagascar has dry forests with trees like the octopus tree that don’t need much water.
Corrected: Madagascar has dry forests with trees, like the octopus tree, that don’t need much water.
Explanation: We put commas around 'like the octopus tree' because it's extra information about the trees. Adding these commas makes the sentence clearer.