You can use a washing machine without laundry detergent however your clothes won't really get too clean without laundry detergent.
If you don't have laundry detergent you can use Vinegar to clean your clothes instead or even dish soap or shampoo to clean the laundry.
Baking soda is another way to get clothes clean in the washing machine when you've run out of laundry detergent.