"Why do you kick at My sacrifice and at My offering which I have commanded in My dwelling, and honor your sons above Me, by making yourselves fat with the choicest of every offering of My people Israel?’ 30“Therefore the Lord God of Israel declares, ‘I did indeed say that your house and the house of your father should walk before Me forever’; but now the Lord declares, ‘Far be it from Me—for those who honor Me I will honor, and those who despise Me will be lightly esteemed," (1 Sam. 2:29-30).
These verses demonstrate how God works and communicates in our time frame. There is no reason here to deny God's omniscience. Cannot God know exactly what the future will be (since it is His nature to be all-knowing) and yet allow us the freedom to be able to make choices? I see no reason why not. Our choices would be known by God ahead of time. God's knowing doesn't restrict our ability to make such choices anymore than me knowing that my daughter will choose to eat ice cream over broccoli means that my knowing it denies her the freedom to make a choice when it is time for her to choose which to eat.
Here in 1 Samuel 2:29-30, there is no reason to deny that God knew ahead of time that He would tell them that His action would change when they became unfaithful. The reason is because God works in time and through time when dealing with us. That is what God was doing even when Jesus, God in flesh, became a man. He had to wait until He was in His 30's before He began His ministry and was finally crucified. God didn't just zap Jesus into existence on the cross and have Him die right away. Instead, He worked in time and through time all the while using people--even though God knew what the outcome was going to be.
God knows what will happen if we do a certain thing. He knows if we do another thing, something else will happen. God was working with Israel, urging them to faithfulness and telling them to avoid disobedience. During their faithfulness He told them they would be blessed. He also told them that if they stopped being faithful, there would be consequences. Therefore, during times of faithfulness God told them they would be blessed just as He should--even though God knew they would fall in the future. That is why, when the people freely chose to disobey God, He then appropriately told them that beforehand He would have blessed them, but since they disobeyed He would now punish them. This isn't denying God's omniscience at all.