Osmosis is the net movement of a solvent, usually water, across a semipermeable membrane. This semipermeable membrane is the material that allows solvents and other small molecules to pass across. We're going to say that these cell membranes surrounding living cells are, in fact, semipermeable themselves. These cell membranes prevent solutes from passing through, and these solutes can be ions or large molecules.
If we take a look at this illustration of a semipermeable membrane, here the membrane is asking if you have an appointment. This larger molecule in red is trying to get through and can't get past the barrier. But the smaller ones down here do have an appointment, are allowed to pass through because they are the right size, and they can pass through the semipermeable membrane to the other side. This is the way that semipermeable membranes work. Osmosis involves the net movement of water, but semipermeable membranes can halt and stop certain molecules from traversing from one side to the other side of a living cell.