Agarwood is mentioned five times in the Bible. Four times in the Old Testament (Numbers 24:6; Psalms 45:8, Proverbs 7:17, Song of Solomon 4:14) and once in the New Testament (John 19:39). It is sometimes referred to as aloes or aloeswood in these passages, which has nothing to do with the aloe vera plant that we know of today.
In the Numbers passage, Balaam the prophet was also a sorcerer (Numbers 24:1). He was talking to Balak the king of the Moabites who wanted him to curse Israel, but he blessed them instead. He was speaking about Israel by metaphorically comparing Israel to aloes, also suggesting that God was speaking through Baalam. Aloes trees grew in India and China, and were included with other plants to make good spices, it seems. It is possible that this tree could have been cultivated around the Jordan valley during this time.