Hi Sadhana
When using group mode on a discussion forum each discussion thread is 'assigned' to a group at the time of posting, for visible groups this is done when the use selects a group from the Visible Group dropdown, at the top left, then adds their discussion (in separate groups it's automatic as users are forced to use their groups - teachers must select the group first though because they can access all groups!).
When using Visible groups on a forum, if a student is not assigned to a group their post is available to 'All Participants' automatically - so everyone can reply and view if 'All Participants' in selected from the visible groups dropdown.
When the same student is assigned to a group their 'All participants' post will stay in the forum for everyone, but won't be assigned to their group (as it was initially posted to 'All Participants').
To ensure all student's posts are assigned to the relevant group the students need to be assigned to groups before they start posting.
If they start posting to form their groups, perhaps you could create one thread to All Participants and ask the students to reply to that one to form their groups. Once you have assigned someone to their relevant group advise them they can start new discussions for their group - I guess you could also have two forums (one for forming the groups and another for the actual group work).
I hope this makes sense - it's a bit wordy but hopefully it is helpful
Cheers
Teresa