We have some sliding doors in our house, called "pocket doors" by the builders, I believe, and they have a locking mechanism. You might be able to adapt one of them to your sliding bathroom door.
"The time is always right, to do what's right." MLK
'08 34' Classic SO, '12 Ram 2500 4X4, 6.7L Cummins.