There are a few options.
The most common approach is just to use a var when you're building up a structure. This is often the simplest and most readable approach
Another is to use recursive structures, either by writing a recursive function call directly or using something like fold. (I would generally recommend you use standard functions like folds and maps rather than doing your own iterations.)
Another useful idiom for you would be to use something like toMap. This has already been mentioned for the case where you have an existing array like you do, but it can also be useful in conjunction with the foreach loop (or the equivalent functions). For example,
( for (x <- xs)
yield (toKey(x), toVal(y))
).toMap
If the values are static, you can also just do something like this.
Map("a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4)
Personally, when I'm just working with a temporary local map, I find a mutable map is often the most appropriate. It's valuable to understand how to do things in a functional way, and I think everybody should learn Haskell, but Scala's m(x) = y syntax for mutable maps can often lead to extremely simple & concise code.
Scala is intentionally a mixed-paradigm language. My recommendation is to reach for the immutable, functional approaches first but don't be afraid to use the imperative features when they make things simpler—unless there are threads involved.
foldLeftor a tailrec method.