Yes, travelers entering Panama are generally expected to have proof of onward travel. This can be a return ticket to your country of origin or a confirmed ticket to your next destination.
The official Panama tourism entry requirements list a valid passport, a return or onward ticket, proof of at least US$500 in economic solvency, and the address or reason for your stay. Airlines may ask for this before allowing you to board, and immigration officers in Panama may also request it on arrival.
Your onward travel does not necessarily have to be a flight back home. It can usually be a ticket showing that you will leave Panama for another country, such as a flight, bus, or other confirmed travel arrangement, depending on your route and airline policy.
Because airline check-in agents often enforce entry requirements before departure, it is safer to have your onward ticket ready before flying to Panama.