Of course you can grab an ally. If he doesn't want to be grappled, resolve it as you would any other grapple.
The more interesting question, and where I think you'll find table variation, is when the ally's player doesn't want to contest it. For instance, if you're doing it to pull him out of the reach of an opponent so he doesn't have to worry about using Disengage, suffering an opportunity attack, or suffering disadvantage on his attacks. Or if you're trying to pull an ally up who is dangling off a ledge.
In cases where the ally's player wants this to happen, should this action be treated as an attack/contested action, or a free interaction? If it is treated as an attack, can the ally choose to fail? There's no rule to specify how to handle this, so it'll come down to DM ruling. Personally, I would treat it as a grapple attack for the same reason you still need to roll to hit an unconscious opponent - the target isn't resisting, but combat is hectic and there's a greater chance of screwing up. However, I would grant advantage to the grappler, and possibly disadvantage to the ally - depending on how permissive I am with metagaming. ICly, the ally probably isn't expecting it, so his instinct might be to resist, but weighting the roll in favor of the grappler seems like a good way to reward sound tactical thinking.
I wouldn't treat it as a free interaction. Many of the examples of free interactions are arguably more complex than grabbing your buddy by the collar, but I feel this gives the grappler too much activity for his turn.
Again, this is all assuming the ally wants to be grappled. Whatever the case, you only need one hand to grapple, so if you have two free hands, you can grapple two creatures.