Use the method DataTableExtensions.AsEnumerableby adding a link to System.Data.DataSetExtensionsand using System.Data;. Then you can use the following query:
var query = from row in datatable.AsEnumerable()
select row["ID"].ToString();
string[] ids = query.ToArray();
If you really need an array, you can use the last line above or enclose the query in parentheses and call ToArray()in the same way as you did initially. I'm not a fan of the latter approach at all.
In free syntax, it will be:
string[] ids = datatable.AsEnumerable()
.Select(row => row["ID"].ToString())
.ToArray();