Consult your doctor if your cast needs to be covered in the water. Some fiberglass casts can get wet without any covering. They will often tell you this in the initial consultation. If not, be sure to call and ask.
Cover the cast. Take a garbage bag or any other type of plastic and cover the cast completely. Use a rubber band to secure the bag past the end of the cast. You want the rubber band to be tight enough that there will be no room for the water to penetrate the bag, but you do not want to cut off circulation either.
Purchase a cast cover. These are inflatable plastic coverings that fit over your cast to keep it dry during swimming. They can be purchased at drug stores or medical supply stores or online. Ask your doctor if you are unsure where to obtain one.
Dry the cast if it does get wet during swimming. Use a hair dryer on a low heat setting. Lift the cast gently and blow the air on the inside of the cast to dry it out. If you do this right away, you will avoid any problems from the wetness.