You need to have EOF character in the string for BWT to work, because otherwise you can't perform the inverse transform to get the original string back. Without EOF, both strings "ba" and "ab" have the same transformed version ("ba"). With EOF, the transforms are different
ab ba
a b | a | b
b | a b a |
| a b | b a
i.e. ab transforms to "|ab" and ba to "b|a".
EOF is needed for BWT because it marks the point where the character cycle starts.
Re: doing it without the EOF character, according to Wikipedia,
Since any rotation of the input string will lead to the same
transformed string, the BWT cannot be inverted without adding an 'EOF'
marker to the input or, augmenting the output with information, such
as an index, that makes it possible to identify the input string from
the class of all of its rotations.
There is a bijective version of the transform, by which the
transformed string uniquely identifies the original. In this version,
every string has a unique inverse of the same length.
The bijective transform is computed by first factoring the input into
a non-increasing sequence of Lyndon words; such a factorization exists
by the Chen–Fox–Lyndon theorem, and can be found in linear time.
Then, the algorithm sorts together all the rotations of all of these
words; as in the usual Burrows–Wheeler transform, this produces a
sorted sequence of n strings. The transformed string is then obtained
by picking the final character of each of these strings in this sorted
list.