You can absolutely use their stat blocks directly as allies. The real question you have is how to make the ensuing encounter appropriately challenging with the additional allies. You have a few ways to handle this.
Increase the encounter to make up for the allies
This takes some tinkering, but the way I would start is take the encounter xp of the additional guards, and create an encounter worth the same xp, assigning monsters from that group to handle the guards. This will make the encounter seem larger, but not actually change what the PC's are handling. By the time the additional mobs take out the guards, they will be weakened, or the PCs will have had the opportunity to take out the primary enemies (or both). You can also fudge it by subtracting the guard's encounter xp value from the original encounter to determine how "hard" of an encounter it actually is.
Don't use stats, just tell a story
The better option from my standpoint is to not bother with tracking hp and stats from the guards, and use them for a story point. If you want one of the enemies to seem tougher than the rest, have him catch a guard's blade in his bare hand and kill him in one blow. If the PC's are hurting, have the guards finish off one of the weaker foes, or take a hit for them. You can still roll for the guards, but use their deaths and kills to make a cinematic point. You can probably come up with a lot of uses for the guards in this context without worrying about their stats.
Do a mix of both
Have the guards statted out, but don't have a fixed encounter size. If the guards start "winning" too much, bring in reinforcements from the assassins. If the players are losing badly, have the guards come to the rescue (or at least take out or distract a couple enemies).
Give the guards a different objective
The guards really don't care about the PC's survival, they care about the King. Maybe they are just fighting to get a clear path to get him to safety. Have them leave the encounter as quickly as possible with the King in tow (or maybe some of the guards are in on the assassination attempt).
There are a lot of options, so don't feel constrained by the rules. You are the DM after all, your job is to make an interesting story/game with the rest of the players and adjudicate rules. Sometimes eyeballing it or making things happen because the story needs it is your job.