Compton, whose half-century helped Somerset beat Derbyshire on Monday, has been in poor form for England recently and was a major doubt for the upcoming Ashes series with Australia.
Pietersen, meanwhile, hit an unbeaten 177 for Surrey at the weekend, his first cricket since having to leave England's Test tour of New Zealand with bone bruising behind his right knee.
Boyd Rankin is the only member of the squad yet to play for England in any format and joins five other pace bowlers in the squad: James Anderson, Tim Bresnan, Stuart Broad, Steven Finn and Graham Onions.
Rankin, Onions and Pietersen are the only players selected who were not named in either squad to face New Zealand in the recent Test series.
Joe Root will open the batting alongside England captain Alastair Cook.
The match against Essex starts on Sunday 30 June at The Essex County Ground, Chelmsford.
Geoff Miller, National Selector, said: “This match is a vital part of our preparations for the Investec Ashes after a period of limited overs cricket for a large number of the squad. We have a very exciting two months of Test cricket coming up and it is important that we start well at Chelmsford next week. Kevin Pietersen has had no complications following his recent return to cricket after a knee injury which is pleasing and Graeme Swann is recovering well from a calf injury.
“We believe Joe Root is currently the best opening partner for Alastair Cook and he will open the batting against Essex. Joe has performed well for Yorkshire at the top of the order earlier this season and during his international career so far has proven to be very adaptable in all three formats and relished the challenge of international cricket.”
Alastair Cook (Essex) (Capt)
James Anderson (Lancashire)
Jonny Bairstow (Yorkshire)
Ian Bell (Warwickshire)
Tim Bresnan (Yorkshire)
Stuart Broad (Nottinghamshire)
Steven Finn (Middlesex)
Graham Onions (Durham)
Kevin Pietersen (Surrey)
Matt Prior (Sussex)
Boyd Rankin (Warwickshire)
Joe Root (Yorkshire)
Graeme Swann (Nottinghamshire)
Jonathan Trott (Warwickshire)