Saul’s action was the product of divine discipline from God. The “spirit from the Lord” was not the Holy Spirit, but an evil spirit
1 Sam. 16:14-23. As David was invested by the Spirit, that same Spirit left Saul. This is evidence of the fact that the presence or absence of the Holy Spirit in the Old Testament says nothing about salvation but only that His power worked in those whom God selected for service (cf. Jud. 3:10; 6:34; 13:25; 14:6; 1 Sam. 10:10; 16:13).
With the departure of the Spirit of God, Saul became tormented by an evil spirit which God permitted to come (v. 14; cf. vv. 15-16; 18:10; 19:9). Whether this spirit had sinful or only harmful characteristics, it is quite certain that it was a demonic, satanic instrument (cf. Job 1:12; 2:6; 1 Kings 22:19-22).
This sets the stage for what happens in 1 Sam 19. What occurs here is not the normal working of the Spirit of, but a special work of God to thwart the plans of Saul. Note the following summary:
Chapter 19. After an initial and successful attempt by Jonathan to soothe his father’s feelings toward David (vv. 1-7), Saul set in motion further steps to destroy David. First he tried to slay him once more with his own hand (vv. 9-10); then he hired conspirators to murder him in his bed, a plot foiled by Michal (vv. 11-17). Next Saul sent men to Naioth at Ramah where David had taken refuge with Samuel (vv. 18-24). (Ramah was Samuel’s hometown.) Their efforts were also unsuccessful for they, and later Saul, were overwhelmed by the Spirit of God who came on them and caused them to “act like prophets” (niv, prophesied, vv. 20-21, 23-24). This means that they fell into a trance or an ecstatic state, a condition which immobilized them and made them incapable of accomplishing their evil intentions.
By laying down naked Saul was divested of his armor and outer robes—in a state of trance. Thus God, in making the wrath of man to praise Him, preserved the lives of all the prophets, frustrated all the purposes of Saul, and preserved the life of His servant.