Joining multiple subqueries
For your example, all you want is

SELECT
  min(pk),
  id,
  array_agg(value ORDER BY value)
FROM foo
GROUP BY id;

 min  | id  |    array_agg     
------+-----+------------------
 pk1  | id1 | {A1,A2,A3,A4,A5}
 pk10 | id2 | {B1,B2,B3,B4,B5}
(2 rows)


If you need the array_agg to be unwrapped, you can do,

SELECT pk, id, a[1] AS v1, a[2] AS v2, a[3] AS v3, a[4] AS v4, a[5] AS v5
FROM (
  SELECT
    min(pk),
    id,
    array_agg(value ORDER BY value)
  FROM foo
  GROUP BY id
) AS t(pk, id, a);

  pk  | id  | v1 | v2 | v3 | v4 | v5 
------+-----+----+----+----+----+----
 pk1  | id1 | A1 | A2 | A3 | A4 | A5
 pk10 | id2 | B1 | B2 | B3 | B4 | B5


Note, in all future examples please don't use id1 and pk1. You're sample values should preferably be just 1 and 2. As you can see here, we're struggling with getting pk10 instead of pk6 and that's a problem only because of the sort order.