Sapporo-Onumakoen (stop over) - Hakodate
and return trip:
Hakodate-Noboribetsu (over night) - Sapporo.
Total length of stay for this route is five days.
Okay, I see, JR Hokkaido is trying to advertise in English some of the (many) discount tickets that are usually advertised in Japanese only, but they don't give nearly as much information.
What you are looking at is probably this: 9,000 yen for a round-trip between Sapporo and Hakodate (or Shin-Hakodate-Hokuto). No, those tickets do not allow stopovers of any length. If you exit the ticket gates at a station, any station, your ticket for that leg will be retained and you cannot get it back.
If you want the ability to make stopovers, you will need to buy regular base fare tickets, which cost 5,720 yen one-way.
JR Hokkaido Ecomonic tickets are valid for one ride. So if you stop for a night along the way (your return example), the ticket would likely not be valid the next day to continue to Sapporo.
But as with most travel rules, there are exceptions, which you need to ask of the ticketing agent when you buy your ticket(s).