Cacti, like other drought-tolerant plants, can survive with little rain because of having the ability of retaining moisture through modified structures, such as spines and thick stems; however, when there is rain, their wide, shallow root systems allow them to absorb water quickly throughout a large area.
Able to do something is idiomatically better than able of -ing form. So, narrow down to B,C and D. C has pronoun reference error, their can refer to cacti or other plants. Besides, option C and D also distort the meaning of original sentence by removing cause-effect relationship. So, incorrect.
A. rain because of having the
ability of retaining - Idiomatically incorrect
B. rain because they are able to retain - Seems no error, hold it.
C. rain,
in their ability to retain - Pronoun reference error and this option distorts the meaning also by removing the cause-effect relation of original sentence.
D. rain,
having their ability to retain - This option distorts the meaning also by removing the cause-effect relation of original sentence.
E. rain, due to having the
ability of retaining - Idiomatically incorrect
Imo. B