If someone is fasting "for" the dead, they obviously think that the dead can be helped in some fashion by that act. Thus, it is the same act in essence as praying for them: some action that we do by which they are aided, in God's grace.
1 Samuel 31:11-13 But when the inhabitants of Ja'besh-gil'ead heard what the Philistines had done to Saul,  all the valiant men arose, and went all night, and took the body of Saul and the bodies of his sons from the wall of Beth-shan; and they came to Jabesh and burnt them there.  And they took their bones and buried them under the tamarisk tree in Jabesh, and fasted seven days. (cf. 1 Chr 10:11-12)
2 Samuel 1:11-12 Then David took hold of his clothes, and rent them; and so did all the men who were with him;  and they mourned and wept and fasted until evening for Saul and for Jonathan his son and for the people of the LORD and for the house of Israel, because they had fallen by the sword.
In 2 Samuel 12:23 (a conceivable counter-argument), King David stops fasting after his son died, but not because the dead can't be aided by prayer and fasting; rather, it was because fasting couldn't restore him to life, as he states: "But now he is dead; why should I fast? Can I bring him back again?"
This actually reinforces my present argument, based on the word "for," since David's servants say to him, "You fasted and wept for the child while it was alive" (2 Sam 12:21). The object was to aid the child: to save his life. Somehow, David hoped, his fasting would spare his son.
When we get to 2 Samuel 1:12, the text states four times: "fasted . . . for Saul and for Jonathan . . . for the people of the LORD . . . for the house of Israel": all of which was directed towards those who "had fallen by the sword." Therefore, by simple grammar and the meaning of words (the same as in the phrase, "prayed for"), it means that they thought that the dead could be aided by such fasting: the same as praying for them: one person does an act by which another can be helped.
* * * * *