Like the rest of Central America, Panama has two distinct seasons: wet and dry. The dry season lasts from mid-December to mid-April, while the rainy season occurs from mid-April to December. On the Caribbean side of Panama, north of the mountains, it rains all year round. This being said, the rain is less in February, March, September and October than it does the rest of the year.
Travelers on a Panama trip will find that temperatures are typically hot in the lowlands throughout the year; days usually reach around 32°C (90°F) and only drop to an average of 22°C (72°F). The humidity brought on by the rainy season makes the heat even harder to endure. Temperatures in the mountains are much cooler, ranging from 10-18°C (50-64°F) in a day, and also vary little throughout the year. If you intend to spend most of your time on the Pacific side, try December or January, when there's generally little rain and the weather is pleasant. If you're doing any serious hiking, this is also the most comfortable time to do it as the Darién Gap can be crossed only at this time.
For packing purposes, be aware that Panama's mountains can get very cold at night; be sure to bring warm clothing for layering.