I don't know if it's okay to use Mr. Clean Magic Eraser to remove all the pencil marks on the bed slats since it uses water. And I always hear water shouldn't be used on wood.
It's perfectly OK to use water on wood, many processes require you to wet the wood surface down with plain water or a watery liquid.
And anyway Magic Erasers don't need to be used with water :-)
I tested denatured alcohol and acetone on a wood sample, but these solvents don't completely remove the pencil marks from the wood.
These are the two go-to solvents for those who remove pencil marks that way. But unfortunately neither is 100% effective in all cases.
You can try wiping multiple times and really bearing down on the paper towel, most of the time for me with stubborn pencil marks that'll get rid of them or get you 90-95% of the way there.
Any remaining can usually be dealt with easily by gentle scraping, sanding or scuffing. And a Magic Eraser could work well for that last bit.
[there are] a bunch of pencil marks on the slats and I want to remove them.
This is a rhetorical question but why? Nobody is ever going to see them.
In case you don't know there's a long tradition in furniture work of not bothering to do work on surfaces that aren't seen in service.
On old furniture (even really good quality stuff) not only can they have pencil, chalk or gauge lines on them they were commonly left unfinished and could even still be rough from the saw or have scrub-plane marks on them!