If you have a course with merged sections, by default, the discussions will allow all students from all sections to respond to each other in the discussions. If you want to keep the students in the individual sections separate, so they can only see and reply to discussions from students in their sections, you can use the Group and Section restrictions option in the discussion.
To enable this setting, edit the topic you want to restrict.
Under the Availability Dates and Conditions section, Click Manage Restrictions under Group and Section Restrictions.
In the pop-up window, there are two options: Restrict topic or Restrict topic and separate the threads.
The option to Restrict Topic will only allow the selected users to view the topic and reply to it.
The option to Restrict topic and separate the threads will allow all selected users to view the topic, but they will only be able to view and reply to posts from the group or section they are enrolled in.
Once you have selected the option you want, you will need to select all of the sections/groups you want to apply these restrictions to.
Once these settings have been configured to your liking, click Add.