Before being rejected by the Philistines in 1 Samuel 29, was David really willing to fight on their side against Israel and his own people? If so, was this not treacherous, even defiance and rebellion against the Lord his God? Or was such action justified in God's eyes because of David's circumstances (being unjustly on Saul's hit-list) at the time?
Not at all! When we read through 1 Samuel, we see that scripture says that David was in reality attacking heathen villages. (Take a look at chapter 27).
David was only feigning loyalty to the heathen king, and is lucky not to have been found out!