It is not clear if the promise of marriage to Merab came after David had enjoyed some success as a military commander or concurrent with it. That is to say, it may be that when Saul gave David a military unit to command (1 Samuel 18:13), he also encouraged him to fight bravely and promised him his daughter’s hand in marriage when he returned from his campaigns.
17 Then Saul said to David, “Here is my elder daughter Merab. I will give her to you for a wife. Only be valiant for me and fight the LORD’s battles.” For Saul thought, “Let not my hand be against him, but let the hand of the Philistines be against him.”