How do I programatically add a Node to an Organic Group in Drupal 7?
Try og_set_association() its listed under their API section of og.module

I have done this in the past with D7, but I believe the API I used has changed since then.