How did birds get wings?

Genesis 1:20 And God said, Let the waters bring forth abundantly the moving creature that hath life, and fowl that may fly above the earth in the open firmament of heaven.
Genesis 1:21 And God created great whales, and every living creature that moveth, which the waters brought forth abundantly, after their kind, and every winged fowl after his kind: and God saw that it was good.

God made them that way so they can fly. It's tough to fly without wings. It's not easy to fly WITH wings, but it's REALLY tough to fly without them.

Answer:
Wings are the result of evolution and have been developed many times in different species (Insects, bats, pterosaurs, birds).
In birds the present evidence indicates that wings developed with early theropod dinosaurs. Contrary to popular belief birds are not descended from pterosaurs, flying reptiles of the Cretaceous Period (210 to 65.5 million years ago.) The feather coating probably came first for insulation or as a mating display, but early feathered dinosaurs could gain a survival edge if the proto-feathers could give them even a small amount of lift to capture flying insects or to leap from tree to tree. This small edge was all that was need for natural selection to allow the development of better and better wings for better and better flight. By 150 million years ago Archaeopterix was present as an early member of the species we now call birds.