It's happening because /ternyata/ is being used as an adverb, and adverbs can move around within the word-order of a sentence. Therefore, it can appear at the beginning of the sentence, as the first word in the predicate (as it appears within this sentence), or as the last word of the sentence (though I don't know how common this final option is).
Option 1: /Dia ternyata tidak datang./
Option 2: /Ternyata, dia tidak datang./
Option 3 (double-check for naturalness): /Dia tidak datang ... ternyata./