You can get away with riding a bike with a rusty chain for a short time. However, it’s not the safest decision. The rust can weaken the chain, and it can snap at any time.
Instead, try cleaning and degreasing your bike chain to remove the rust.