The 1841 British edition accidentally replaced the preposition unto in this passage with to. The 1849 LDS edition restored the original unto. Either usage is theoretically possible, of course, with the use of to as the more modern alternative. Elsewhere in the text, there are eight examples of “to give heed to X” and eight of “to give heed unto X”. Here’s a passage where both prepositions are used in this expression:
For each case of “to give heed (un)to X”, the critical text will follow the earliest reading.
Summary: Maintain in Alma 21:23 the original preposition unto in “they gave heed unto his word”.