Do Muggles have to know a pathway/portal exists at Platform 9 3/4 to pass through it or can they just go through accidentally?
We can divide this into two parts:
- When the Hogwarts term is starting
- Other days
I would guess that if the Hogwarts term is not starting, the platform is closed. I don't have any proof, but given the care and caution, the wizards give about muggles, it sounds likely. It is also supported by the Pottermore quotation in the following part of the answer.
In most of the days in a year, nobody can go through
When the Hogwarts term is starting, it is not that clear.
To cite Pottermore:
There are usually a number of plain-clothed Ministry of Magic employees on hand to deal with any inconvenient Muggle memories that may need altering at the start and end of each Hogwarts term.
I.e. if the muggles would go through accidentally, they wouldn't remember anything from that. So even in that case, it is not that dangerous.
I didn't find anything about that if they can go through accidentally. But there are common charms to repel muggles from something.
We know that from Mr Weasley (HP GoF, Chapter 8)
"Muggle-Repelling Charms on every inch of it. Every time Muggles have got anywhere near here all year, they've suddenly remembered urgent appointments and had to dash away again."
It seems very likely (as there is no reason against it), that some of them are used to this entrance.
Probably, muggles don't try to go near to the entrance at all.
EDIT: I am reading Cursed child now and right in the first scene there is this issue mentioned:
GINNY: All you have to do is walk straight at the wall between platforms nine and ten.
LILY: I’m so excited.
HARRY: Don’t stop and don’t be scared you’ll crash into it, that’s very important. Best to do it at a run if you’re nervous.
ALBUS: I’m ready.
that’s very important
it sounds that in the case you are scared or stopping, you won't get through. Muggles don't have any reason to think they will go through or to run.