What would produce a force that depends on the sine or cosine of the distance?
Yes. A simple pendulum has a force proportional to $\sin \theta$, although a small-angle approximation is generally used, wherein $\theta$ is used instead. One might object that $\theta$ is not a length. I suspect that a "truly" sinusoidal force dependent on linear Euclidean distance might be difficult.
How about this: A pendulum will have a force based on the tilt, which is related to the sin of the angle. Allow a weight to work in the manner. Then, using mechanical computing principles, arrange for a light-weight cursor to ride in a track that moves horizontally only, in a straight line. The weight rises behind the front panel, and the visible cursor shows the horizontal component only.
When you move the cursor, using a hand-held spring to tug it along the track, you will measure the restoring force to be proportional to the sin of the distance where full extension on the track is 1 unit.