According to Timatic, the database used by airlines to check for document requirements (and courtesy of Emirates), you may transit without visa, but could not leave the
Passport holder of Pakistan
Destination Japan
Transit countries/territories Korea, Republic of
TWOV (Transit Without Visa):
Passengers transiting through Seoul (ICN) with a confirmed onward ticket for a flight to a third country within 24 hours. They must stay in the international transit area of the airport and have documents required for the next destination.
Passengers transiting through Seoul (ICN) with a confirmed onward ticket for a flight to a third country within 72 hours. They must:
- join a transit tour organized by Seoul (ICN), and
- have documents required for the next destination.
Passengers with a confirmed onward ticket for a flight to a third country on the same calendar day. They must stay in the international transit area of the airport and have documents required for the next destination.
The Incheon Airport Transit Hotel is located within Incheon International Airport’s departure lounge.