Wrap your hands around the base of one of the posts and turn it gently. If the bed frame is old, the post may be hard to unscrew, and you may have to turn the post several times before it loosens. If you have trouble unscrewing the post, squirt penetrating oil into the crease between the post and the bed frame. Allow the oil to set in then try to unscrew the post.
Turn the post until it lifts off of the bed frame. Repeat for the other three posts.
Select new screw-in posts. Take one of the old posts into a furniture or mattress retailer to match up the type of screw and its diameter for replacement posts. Or if you're handy with woodworking tools, you can create your own bed posts from newel posts with a cordless drill and the appropriate-sized screws.
Place one of the posts over the hole in the bed frame and screw it in. Repeat for the other three posts.